#include <stdio.h>
int isHole[1000005];
int main(){
int n, m, k;
scanf("%d%d%d", &n, &m, &k);
for(int i=0; i<m; i++){
int h;
scanf("%d", &h);
isHole[h] = 1;
}
int pos = 1;
for(int i=0; i<k; i++){
int u, v;
scanf("%d%d", &u, &v);
if(u == pos && (!isHole[u])) pos = v;
else if(v == pos && (!isHole[v])) pos = u;
}
printf("%d", pos);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgaXNIb2xlWzEwMDAwMDVdOwoKaW50IG1haW4oKXsKICAgIGludCBuLCBtLCBrOwogICAgc2NhbmYoIiVkJWQlZCIsICZuLCAmbSwgJmspOwogICAgZm9yKGludCBpPTA7IGk8bTsgaSsrKXsKICAgICAgICBpbnQgaDsKICAgICAgICBzY2FuZigiJWQiLCAmaCk7CiAgICAgICAgaXNIb2xlW2hdID0gMTsKICAgIH0KICAgIGludCBwb3MgPSAxOwogICAgZm9yKGludCBpPTA7IGk8azsgaSsrKXsKICAgICAgICBpbnQgdSwgdjsKICAgICAgICBzY2FuZigiJWQlZCIsICZ1LCAmdik7CiAgICAgICAgaWYodSA9PSBwb3MgJiYgKCFpc0hvbGVbdV0pKSBwb3MgPSB2OwogICAgICAgIGVsc2UgaWYodiA9PSBwb3MgJiYgKCFpc0hvbGVbdl0pKSBwb3MgPSB1OwogICAgfQogICAgcHJpbnRmKCIlZCIsIHBvcyk7CiAgICByZXR1cm4gMDsKfQ==