/*
ID: barish21
LANG: C++14
TASK: test
*/
/****Author: Barish Namazov****/
#include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <cstdio>
#include <queue>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <map>
#include <set>
#include <stack>
#include <cstring>
#include <cmath>
using namespace std;
/***TEMPLATE***/
#define intt long long
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define sz(s) (intt)s.size()
#define ms0(arr) memset(arr,0,sizeof arr)
#define ms63(arr) memset(arr,63,sizeof arr)
#define forn(i,a,b) for(intt i=a;i<=b;i++)
#define rofn(i,a,b) for(intt i=a;i>=b;i--)
#define setf(it,myset) for(set<intt>::iterator it=myset.begin();it!=myset.end();it++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define VI vector<intt>
#define PII pair<intt,intt>
#define VPII vector< PII >
#define posl(ch) (int)(ch-'a'+1)
#define posL(ch) (int)(ch-'A'+1)
#define IO ios_base::sync_with_stdio(false);cin.tie();
/***************/
/***Additional Functions***/
intt powmod(intt a,intt b,intt mod){intt res=1;a%=mod;assert(b>=0);for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
intt gcd(intt a,intt b){return __gcd(a, b);}
intt lcm(intt a,intt b){return a*b/gcd(a,b);}
intt is_prime(intt n){if(n==1)return 0;if(n==2)return 1;if(n%2==0)return 0;for(intt i=3;i<=sqrt(n);i+=2)if(n%i==0)return 0;return 1;}
intt is_integer(double n){if(floor(n)==ceil(n))return 1;return 0;}
intt sto_int(string s){stringstream ss(s);intt n;ss>>n;return n;}
string to_string(intt n){stringstream ss;ss<<n;string s=ss.str();return s;}
/**************************/
intt arr[1000001], holes[1000001], bone;
int main()
{
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
//ofstream fout ("test.out");
//ifstream fin ("test.in");
IO;
intt n, m, k;
cin >> n >> m >> k;
for (intt i = 1; i <= m; i++) {
intt t;
cin >> t;
holes[t] = 1;
}
bone = 1;
for (intt i = 1; i <= k; i++) {
intt a, b;
cin >> a >> b;
if (holes[bone]) {
cout << bone << endl;
return 0;
}
if (bone == a)
bone = b;
else
if (bone == b)
bone = a;
if (holes[bone]) {
cout << bone << endl;
return 0;
}
//cout << bone << endl;
}
cout << bone << endl;
return 0;
}
LyoKSUQ6IGJhcmlzaDIxCkxBTkc6IEMrKzE0ClRBU0s6IHRlc3QKKi8KCi8qKioqQXV0aG9yOiBCYXJpc2ggTmFtYXpvdioqKiovCiNpbmNsdWRlIDxiaXRzL3N0ZGMrKy5oPgojaW5jbHVkZSA8aW9zdHJlYW0+CiNpbmNsdWRlIDxmc3RyZWFtPgojaW5jbHVkZSA8Y3N0ZGlvPgojaW5jbHVkZSA8cXVldWU+CiNpbmNsdWRlIDx2ZWN0b3I+CiNpbmNsdWRlIDxhbGdvcml0aG0+CiNpbmNsdWRlIDxpb21hbmlwPgojaW5jbHVkZSA8bWFwPgojaW5jbHVkZSA8c2V0PgojaW5jbHVkZSA8c3RhY2s+CiNpbmNsdWRlIDxjc3RyaW5nPgojaW5jbHVkZSA8Y21hdGg+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKLyoqKlRFTVBMQVRFKioqLwojZGVmaW5lIGludHQgbG9uZyBsb25nCgojZGVmaW5lIGFsbCh2KSAodikuYmVnaW4oKSwodikuZW5kKCkKI2RlZmluZSByYWxsKHYpICh2KS5yYmVnaW4oKSwodikucmVuZCgpCiNkZWZpbmUgc3oocykgKGludHQpcy5zaXplKCkKCiNkZWZpbmUgbXMwKGFycikgbWVtc2V0KGFyciwwLHNpemVvZiBhcnIpCiNkZWZpbmUgbXM2MyhhcnIpIG1lbXNldChhcnIsNjMsc2l6ZW9mIGFycikKCiNkZWZpbmUgZm9ybihpLGEsYikgZm9yKGludHQgaT1hO2k8PWI7aSsrKQojZGVmaW5lIHJvZm4oaSxhLGIpIGZvcihpbnR0IGk9YTtpPj1iO2ktLSkKI2RlZmluZSBzZXRmKGl0LG15c2V0KSBmb3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HMpe3N0cmluZ3N0cmVhbSBzcyhzKTtpbnR0IG47c3M+Pm47cmV0dXJuIG47fQpzdHJpbmcgdG9fc3RyaW5nKGludHQgbil7c3RyaW5nc3RyZWFtIHNzO3NzPDxuO3N0cmluZyBzPXNzLnN0cigpO3JldHVybiBzO30KCi8qKioqKioqKioqKioqKioqKioqKioqKioqKi8KCmludHQgYXJyWzEwMDAwMDFdLCBob2xlc1sxMDAwMDAxXSwgYm9uZTsKaW50IG1haW4oKQp7CiAgICAvL2ZyZW9wZW4oImluLnR4dCIsInIiLHN0ZGluKTsKICAgIC8vZnJlb3Blbigib3V0LnR4dCIsInciLHN0ZG91dCk7CiAgICAvL29mc3RyZWFtIGZvdXQgKCJ0ZXN0Lm91dCIpOwogICAgLy9pZnN0cmVhbSBmaW4gKCJ0ZXN0LmluIik7CiAgICBJTzsKICAgIGludHQgbiwgbSwgazsKICAgIGNpbiA+PiBuID4+IG0gPj4gazsKICAgIGZvciAoaW50dCBpID0gMTsgaSA8PSBtOyBpKyspIHsKICAgICAgICBpbnR0IHQ7CiAgICAgICAgY2luID4+IHQ7CiAgICAgICAgaG9sZXNbdF0gPSAxOwogICAgfQogICAgYm9uZSA9IDE7CiAgICBmb3IgKGludHQgaSA9IDE7IGkgPD0gazsgaSsrKSB7CiAgICAgICAgaW50dCBhLCBiOwogICAgICAgIGNpbiA+PiBhID4+IGI7CiAgICAgICAgaWYgKGhvbGVzW2JvbmVdKSB7CiAgICAgICAgICAgIGNvdXQgPDwgYm9uZSA8PCBlbmRsOwogICAgICAgICAgICByZXR1cm4gMDsKICAgICAgICB9CiAgICAgICAgaWYgKGJvbmUgPT0gYSkKICAgICAgICAgICAgYm9uZSA9IGI7CiAgICAgICAgICAgIGVsc2UKICAgICAgICBpZiAoYm9uZSA9PSBiKQogICAgICAgICAgICBib25lID0gYTsKICAgICAgICBpZiAoaG9sZXNbYm9uZV0pIHsKICAgICAgICAgICAgY291dCA8PCBib25lIDw8IGVuZGw7CiAgICAgICAgICAgIHJldHVybiAwOwogICAgICAgIH0KICAgICAgICAvL2NvdXQgPDwgYm9uZSA8PCBlbmRsOwogICAgfQogICAgY291dCA8PCBib25lIDw8IGVuZGw7CiAgICByZXR1cm4gMDsKfQ==