#include <bits/stdc++.h>
using namespace std;
bool mp[1000009];
int main() {
  long long n, m, k;
  cin >> n >> m >> k;
  while (m--) {
    long long a;
    scanf("%lld", &a);
    mp[a] = true;
  }
  long long x = 1;
  if (mp[x]) {
    cout << x << endl;
    return 0;
  }
  while (k--) {
    long long u, v;
    scanf("%lld %lld", &u, &v);
    if (u == x)
      x = v;
    else if (v == x)
      x = u;
    if (mp[x]) {
      break;
    }
  }
  cout << x << endl;
  ;
  return 0;
}
