#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-7;
const int INF = 0x3f3f3f3f;
const int MAX_N = (int)2e6 + 17;
const int mod = (int)1e9 + 7 + eps;
int N, M, S, T, K, tp, bk;
int a[MAX_N];
void debug(int nCount, ...) {
  va_list argptr;
  va_start(argptr, nCount);
  cout << "debug:";
  for (int i = 0; i < nCount; i++) cout << " " << va_arg(argptr, int);
  putchar('\n');
  va_end(argptr);
}
int main() {
  int kase = 1;
  while (~scanf("%d %d %d", &N, &M, &K)) {
    memset(a, 0, sizeof(a));
    for (int i = 1; i <= M; i++) {
      int x;
      scanf("%d", &x);
      a[x] = 1;
    }
    int ans = 1;
    int flag = a[1];
    while (K--) {
      int x, y;
      scanf("%d %d", &x, &y);
      if (flag) continue;
      if (ans == x) {
        ans = y;
      } else if (ans == y) {
        ans = x;
      }
      flag = a[ans];
    }
    printf("%d\n", ans);
  }
  return 0;
}
