#include <bits/stdc++.h>
using namespace std;
bool hol[1000010];
int main() {
  int n, m, k;
  scanf("%d %d %d", &n, &m, &k);
  memset(hol, false, sizeof(hol));
  for (int i = 0; i < m; i++) {
    int x;
    scanf("%d", &x);
    hol[x] = true;
  }
  int cur = 1;
  bool run = true;
  if (hol[cur]) run = false;
  while (k--) {
    int v, u;
    scanf("%d %d", &v, &u);
    if (cur == v && run) {
      cur = u;
      if (hol[cur]) run = false;
    } else if (cur == u && run) {
      cur = v;
      if (hol[cur]) run = false;
    }
  }
  printf("%d\n", cur);
}
