#include <bits/stdc++.h>
using namespace std;
bool holes[1000009];
int main() {
  long n, m, k;
  scanf("%ld%ld%ld", &n, &m, &k);
  long pos = 1;
  long x, y;
  memset(holes, false, n + 1);
  for (long i = 1; i <= m; i++) {
    scanf("%ld", &x);
    holes[x] = true;
  }
  if (holes[pos]) {
    printf("%ld", pos);
    return 0;
  }
  for (long i = 0; i < k; i++) {
    cin >> x >> y;
    if (x == pos)
      pos = y;
    else if (y == pos)
      pos = x;
    if (holes[pos]) {
      printf("%ld", pos);
      return 0;
    }
  }
  printf("%ld", pos);
  return 0;
}
