#include <bits/stdc++.h>
using namespace std;
int a[1000005];
int d[1000005];
int main() {
  int x1, x2, n, m, k, i, num, flag, ans;
  cin >> n >> m >> k;
  memset(a, 0, sizeof(a));
  memset(d, 0, sizeof(d));
  for (i = 0; i < m; i++) {
    cin >> num;
    d[num] = 1;
  }
  a[1] = 1;
  flag = 0;
  ans = 1;
  for (i = 0; i < k; i++) {
    cin >> x1 >> x2;
    if (x1 == ans) {
      if (d[x1] != 1) {
        ans = x2;
      }
    } else if (x2 == ans) {
      if (d[x2] != 1) {
        ans = x1;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
