Zane the wizard is going to perform a magic show shuffling the cups.

There are n cups, numbered from 1 to n, placed along the x-axis on a table that has m holes on it. More precisely, cup i is on the table at the position x = i.

The problematic bone is initially at the position x = 1. Zane will confuse the audience by swapping the cups k times, the i-th time of which involves the cups at the positions x = ui and x = vi. If the bone happens to be at the position where there is a hole at any time, it will fall into the hole onto the ground and will not be affected by future swapping operations.

Do not forget that Zane is a wizard. When he swaps the cups, he does not move them ordinarily. Instead, he teleports the cups (along with the bone, if it is inside) to the intended positions. Therefore, for example, when he swaps the cup at x = 4 and the one at x = 6, they will not be at the position x = 5 at any moment during the operation.

<image>

Zane’s puppy, Inzane, is in trouble. Zane is away on his vacation, and Inzane cannot find his beloved bone, as it would be too exhausting to try opening all the cups. Inzane knows that the Codeforces community has successfully helped Zane, so he wants to see if it could help him solve his problem too. Help Inzane determine the final position of the bone.

Input

The first line contains three integers n, m, and k (2 ≤ n ≤ 106, 1 ≤ m ≤ n, 1 ≤ k ≤ 3·105) — the number of cups, the number of holes on the table, and the number of swapping operations, respectively.

The second line contains m distinct integers h1, h2, ..., hm (1 ≤ hi ≤ n) — the positions along the x-axis where there is a hole on the table.

Each of the next k lines contains two integers ui and vi (1 ≤ ui, vi ≤ n, ui ≠ vi) — the positions of the cups to be swapped.

Output

Print one integer — the final position along the x-axis of the bone.

Examples

Input

7 3 4
3 4 6
1 2
2 5
5 7
7 1


Output

1

Input

5 1 2
2
1 2
2 4


Output

2

Note

In the first sample, after the operations, the bone becomes at x = 2, x = 5, x = 7, and x = 1, respectively.

In the second sample, after the first operation, the bone becomes at x = 2, and falls into the hole onto the ground.
        			/*
        		     * Author- Priyam Vora
        		     * BTech 2nd Year DAIICT
        		     */
     
     
        		    import java.awt.Point;
import java.io.*;
        		    import java.math.*;
        		    import java.util.*;
        		    import javax.print.attribute.SetOfIntegerSyntax;
     
     
     
        		    public class Main{
        		    	private static InputStream stream;
        		    	private static byte[] buf = new byte[1024];
        		    	private static int curChar;
        		    	private static int numChars;
        		    	private static SpaceCharFilter filter;
        		    	private static PrintWriter pw;
        		    	private static long count = 0,mod=1000000007;
        		    //	private static TreeSet<Integer> ts=new TreeSet[200000];
     
        		        public static void main(String[] args) {
        		        	InputReader(System.in);
        		    		pw = new PrintWriter(System.out); 
        		            new Thread(null ,new Runnable(){
        		               public void run(){
        		                   try{
        		                       soln2();
        		                       pw.close();
        		                   } catch(Exception e){
        		                       e.printStackTrace();
        		                   }
        		               }
        		           },"1",1<<26).start();
        		       }
        		        public static void Merge(long a[],int p,int r){
        		            if(p<r){
        		                int q = (p+r)/2;
        		                Merge(a,p,q);
        		                Merge(a,q+1,r);
        		                Merge_Array(a,p,q,r);
        		            }
        		        }
        		        public static void Merge_Array(long a[],int p,int q,int r){
        		           long b[] = new long[q-p+1];
        		            long c[] = new long[r-q];
        		            for(int i=0;i<b.length;i++)
        		                b[i] = a[p+i];
        		            for(int i=0;i<c.length;i++)
        		                c[i] = a[q+i+1];
        		            int i = 0,j = 0;
        		            for(int k=p;k<=r;k++){
        		                if(i==b.length){
        		                    a[k] = c[j];
        		                    j++;
        		                }
        		                else if(j==c.length){
        		                    a[k] = b[i];
        		                    i++;
        		                }
        		                else if(b[i]<c[j]){
        		                    a[k] = b[i];
        		                    i++;
        		                }
        		                else{
        		                    a[k] = c[j];
        		                    j++;
        		                }
        		            }
        		        }
        		    	public static long gcd(long x, long y) {
        		    		if (x == 0)
        		    			return y;
        		    		else
        		    			return gcd( y % x,x);
        		    	}	public static boolean isPrime(int n) {
        		    	// Corner cases
			    		if (n <= 1)
			    			return false;
			    		if (n <= 3)
			    			return true;
			     
			    		// This is checked so that we can skip 
			    		// middle five numbers in below loop
			    		if (n % 2 == 0 || n % 3 == 0)
			    			return false;
			     
			    		for (int i = 5; i * i <= n; i = i + 6)
			    			if (n % i == 0 || n % (i + 2) == 0)
			    				return false;
			     
			    		return true;
			    	}
        		        static LinkedList<Integer> adj[];
        		        static boolean Visited[];
        		        static HashSet<Integer> exc;
        		        static long oddsum[]=new long[1000001];
        		        private static void soln2(){
        		        	
        		        	
        		        	
        		        	HashSet<Integer> prime=new HashSet<Integer>();
        		        	int n=nextInt();
        		        	int m=nextInt(); 	
        		        	int k=nextInt();
        		        	boolean b[]=new boolean[n+1];
        		        	b[1]=true;
        		        	HashSet<Integer> hole=new HashSet<Integer>();
        		        	for(int i=0;i<m;i++){
        		        		hole.add(nextInt());
        		        	}
        		        	if(hole.contains(1)){
    		        			pw.println(1);
    		        			return;
    		        		}
        		        	for(int i=0;i<k;i++){
        		        		int v=nextInt();
        		        		
        		        		int w=nextInt();
        		        		
        		        		if(v!=w && b[v]==true){
        		        			b[w]=true;
        		        			b[v]=false;
        		        		if(hole.contains(w)){
        		        			pw.println(w);
        		        			return;
        		        		}
        		        		}
        		        		else if(v!=w && b[w]==true){
        		        			b[v]=true;
        		        			b[w]=false;
        		        			if(hole.contains(v)){
        		        				pw.println(v);
        		        				return;
        		        			}
        		        		}
        		        	//	pArray(b);
        		        		
        		        	}
        		        	for(int i=1;i<=n;i++){
        		        		if(b[i]){
        		        			pw.println(i);
        		        			return;
        		        		}
        		        	}
        		        	
        		        	
        		        	}
        		              		     
        		        static int state=1;
        		        static long no_exc=0,no_vert=0;
        		      static Stack<Integer> st;
        		      static HashSet<Integer> inset;
        		        private static void topo(int curr){
        		        	
        		        	Visited[curr]=true;
        		        	inset.add(curr);
        		        	for(int x:adj[curr]){
        		        		if(adj[x].contains(curr) || inset.contains(x)){
        		        			state=0;
        		        			return;
        		        		}
        		        		if(state==0)
        		        			return;
        		        		
        		        	}
        		        	st.push(curr);
        		        	
        		        	inset.remove(curr);
        		        }
        		        static HashSet<Integer> hs;
        		        private static void dfs(int x){
        		        	Visited[x]=true;
        		        	no_vert++;
        		        	if(exc.contains(x)){
        		        		no_exc++;
        		        	}
        		        	for(int i: adj[x]){
        		        		if(!Visited[i]){
        		        			dfs(i);
        		        		}
        		        	}
        		        }
        		     	private static void buildgraph(int n){
        		    		adj=new LinkedList[n+1];
        		    		Visited=new boolean[n+1];
        		    		st=new Stack<Integer>();
        		    		inset=new HashSet<Integer>();
        		    		exc=new HashSet<Integer>();
        		    		
        		    		state=1;
        		    		for(int i=0;i<=n;i++){
        		    			adj[i]=new LinkedList<Integer>();
        		    		
        		    		}
     
     
        		    	}
        		     	
        		    	// To Get Input
        		    	// Some Buffer Methods
     
        		    	public static void InputReader(InputStream stream1) {
        		    		stream = stream1;
        		    	}
     
        		    	private static boolean isWhitespace(int c) {
        		    		return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        		    	}
     
        		    	private static boolean isEndOfLine(int c) {
        		    		return c == '\n' || c == '\r' || c == -1;
        		    	}
     
        		    	private static int read() {
        		    		if (numChars == -1)
        		    			throw new InputMismatchException();
        		    		if (curChar >= numChars) {
        		    			curChar = 0;
        		    			try {
        		    				numChars = stream.read(buf);
        		    			} catch (IOException e) {
        		    				throw new InputMismatchException();
        		    			}
        		    			if (numChars <= 0)
        		    				return -1;
        		    		}
        		    		return buf[curChar++];
        		    	}
     
        		    	private static int nextInt() {
        		    		int c = read();
        		    		while (isSpaceChar(c))
        		    			c = read();
        		    		int sgn = 1;
        		    		if (c == '-') {
        		    			sgn = -1;
        		    			c = read();
        		    		}
        		    		int res = 0;
        		    		do {
        		    			if (c < '0' || c > '9')
        		    				throw new InputMismatchException();
        		    			res *= 10;
        		    			res += c - '0';
        		    			c = read();
        		    		} while (!isSpaceChar(c));
        		    		return res * sgn;
        		    	}
     
        		    	private static long nextLong() {
        		    		int c = read();
        		    		while (isSpaceChar(c))
        		    			c = read();
        		    		int sgn = 1;
        		    		if (c == '-') {
        		    			sgn = -1;
        		    			c = read();
        		    		}
        		    		long res = 0;
        		    		do {
        		    			if (c < '0' || c > '9')
        		    				throw new InputMismatchException();
        		    			res *= 10;
        		    			res += c - '0';
        		    			c = read();
        		    		} while (!isSpaceChar(c));
        		    		return res * sgn;
        		    	}
     
        		    	private static String nextToken() {
        		    		int c = read();
        		    		while (isSpaceChar(c))
        		    			c = read();
        		    		StringBuilder res = new StringBuilder();
        		    		do {
        		    			res.appendCodePoint(c);
        		    			c = read();
        		    		} while (!isSpaceChar(c));
        		    		return res.toString();
        		    	}
     
        		    	private static String nextLine() {
        		    		int c = read();
        		    		while (isSpaceChar(c))
        		    			c = read();
        		    		StringBuilder res = new StringBuilder();
        		    		do {
        		    			res.appendCodePoint(c);
        		    			c = read();
        		    		} while (!isEndOfLine(c));
        		    		return res.toString();
        		    	}
     
        		    	private static int[] nextIntArray(int n) {
        		    		int[] arr = new int[n];
        		    		for (int i = 0; i < n; i++) {
        		    			arr[i] = nextInt();
        		    		}
        		    		return arr;
        		    	}
     
        		    	private static int[][] next2dArray(int n, int m) {
        		    		int[][] arr = new int[n][m];
        		    		for (int i = 0; i < n; i++) {
        		    			for (int j = 0; j < m; j++) {
        		    				arr[i][j] = nextInt();
        		    			}
        		    		}
        		    		return arr;
        		    	}
        		    	private static char[][] nextCharArray(int n,int m){
        		    		char [][]c=new char[n][m];
        		    		for(int i=0;i<n;i++){
        		    			String s=nextLine();
        		    			for(int j=0;j<s.length();j++){
        		    				c[i][j]=s.charAt(j);
        		    			}
        		    		}
        		    		return c;
        		    	}
     
        		    	private static long[] nextLongArray(int n) {
        		    		long[] arr = new long[n];
        		    		for (int i = 0; i < n; i++) {
        		    			arr[i] = nextLong();
        		    		}
        		    		return arr;
        		    	}
     
        		    	private static void pArray(int[] arr) {
        		    		for (int i = 0; i < arr.length; i++) {
        		    			pw.print(arr[i] + " ");
        		    		}
        		    		pw.println();
        		    		return;
        		    	}
     
        		    	private static void pArray(long[] arr) {
        		    		for (int i = 0; i < arr.length; i++) {
        		    			pw.print(arr[i] + " ");
        		    		}
        		    		pw.println();
        		    		return;
        		    	}
     
        		    	private static void pArray(boolean[] arr) {
        		    		for (int i = 0; i < arr.length; i++) {
        		    			pw.print(arr[i] + " ");
        		    		}
        		    		pw.println();
        		    		return;
        		    	}
     
        		    	private static boolean isSpaceChar(int c) {
        		    		if (filter != null)
        		    			return filter.isSpaceChar(c);
        		    		return isWhitespace(c);
        		    	}
     
        		    	private interface SpaceCharFilter {
        		    		public boolean isSpaceChar(int ch);
        		    	}
     
     
    }
        		    
        		    class Node{
        		    	int to;
        		    	long dist;
        		    	Node(int to,long dist){
        		    		this.to=to;
        		    		this.dist=dist;
        		    	}
        		    	
        		    }
        		/*	class Pair implements Comparable<Pair>{
						
						int city,pop;
						Pair(int city,int pop){
							this.city=city;
							this.pop=pop;
						}
						@Override
						public int compareTo(Pair o) {
				return pop-this.pop;
				
						}
						public int hashCode() {
		    	    			int hu = (int) (city ^ (city >>> 32));
		    	    			int hv = (int) (pop ^ (pop >>> 32));
		    	    			//int hw = (int) (mass ^ (mass >>> 32));
		    	    			return 31 * hu + hv ;
		    	    		//return 0;
		    				}
		    				public boolean equals(Object o) {
		    	    			Pair other = (Pair) o;
		    	    			return city == other.city && pop == other.pop;
		    	    		}
					}*/  class Dsu{
	    		    	private int rank[], parent[] ,n;
	    		    	private static int[] parent1;
	    		    	Dsu(int size){
	    		    		this.n=size+1;
	    		    		rank=new int[n];
	    		    		//parent=new int[n];
	    		    		parent=new int[n];
	    		    	makeSet();
	    		
	    		    	}
	    		    	
	    		    	void makeSet(){
	    		    		for(int i=0;i<n;i++){
	    		    			parent[i]=i;
	    		    		}
	    		    	}
	    		    	
	    		    	int find(int x){
	    		    		if(parent[x]!=x){
	    		    			
	    		    			parent[x]=find(parent[x]);
	    		    		}
	    		    		return parent[x];
	    		    	}
	    		    
	    		    	
	    		    	boolean union(int x,int y){
	    		    		int xRoot=find(x);
	    		    		int yRoot=find(y);
	    		    		
	    		    		if(xRoot==yRoot)
	    		    			return false;
	    		    		if(rank[xRoot]<rank[yRoot]){
	    		    		parent[xRoot]=yRoot;	
	    		    		}else if(rank[yRoot]<rank[xRoot]){
	    		    			parent[yRoot]=xRoot;
	    		    		}else{
	    		    			parent[yRoot]=xRoot;
	    		    			rank[xRoot]++;
	    		    		}
	    		    		return true;
	    		    	}

	    		     
	    		    }