#include <bits/stdc++.h>
using namespace std;
int a[1000001], i, j, n, m, k, temp, c1, c2, ans = 1;
int main() {
  cin >> n >> m >> k;
  for (i = 0; i < m; i++) {
    cin >> j;
    a[j] = 1;
  }
  if (a[1] == 1) {
    cout << 1;
    return 0;
  }
  while (k--) {
    scanf("%d %d", &c1, &c2);
    if (ans == c1)
      ans = c2;
    else if (ans == c2)
      ans = c1;
    if (a[ans] == 1) break;
  }
  printf("%d", ans);
}
