#include <bits/stdc++.h>
using namespace std;
int n, m, k, b[1000005], cur;
int main() {
  int x, y;
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 1; i <= m; i++) {
    scanf("%d", &x);
    b[x] = 1;
  }
  cur = 1;
  while (k--) {
    scanf("%d%d", &x, &y);
    if (b[cur] == 1) break;
    if (x == cur)
      cur = y;
    else if (y == cur)
      cur = x;
  }
  printf("%d", cur);
}
