It is the well-known annual day *"Tavalbao"* , Shengdebao's birthday!
In his birthday he has received gifts from all his friends and relatives. One particular present appeared the most interesting, A digraph (Directed Graph) which has vertices and directed edges. On vertex number is written. After his birthday party Shengdebao got bored and started traversing the graph. He decided to start from an arbitrary vertex and start traversing some edges in their directions. While doing so, he wanted to keep track of a number . Initially number is equal to (the label written on the starting vertex) after passing an edge he will write after the last digit of .
For example if he starts from vertex with label and goes to vertex with label we will have .
He intends to traverse over a walk (this walk can contain repeated edges or vertices) and write down number so that has exactly digits, since is his favorite number, and between all the available ways, should be maximized.
You're Shengdebao's friend so give the guy a hand and help him!
In the first line numbers are given denoting the number of vertices , edges and Shengdebao's favorite number in order.
Next line contains integers one after another, th integer is equal to . (the number written on vertex )
Afterwards lines each consisting of two integers are given showing edge exists in the graph.
The graph can contain loops or multiple edges.
In the only line of output display the digit number that is maximized.
Display if no answer exists!