#include <bits/stdc++.h>
using namespace std;
int p[1000004] = {0};
int f[1000004] = {0};
int main() {
  p[1] = 1;
  long long n, m, k, x, y, r = 1, me;
  scanf("%lld %lld %lld", &n, &m, &k);
  for (int i = 0; i < m; i++) {
    scanf("%lld", &x);
    f[x] = {-1};
  }
  for (int i = 0; i < k; i++) {
    scanf("%lld %lld", &x, &y);
    if (p[x] == 1 || p[y] == 1) {
      if (f[r] == -1) break;
      me = p[x];
      p[x] = p[y];
      p[y] = me;
      if (p[x] == 1)
        r = x;
      else
        r = y;
      if (f[r] == -1) break;
    }
  }
  printf("%lld", r);
  return 0;
}
