#include <bits/stdc++.h>
int main() {
  long long int x, y, n;
  long long int d, vis[1000005], dis[1000005];
  long long int a, b;
  long long int i, j, flag;
  while (scanf("%lld %lld %lld", &x, &y, &n) != EOF) {
    memset(vis, 0, sizeof(vis));
    for (i = 0; i < y; i++) {
      scanf("%lld", &d);
      vis[d] = 1;
    }
    flag = 1;
    while (n--) {
      int a, b;
      scanf("%d%d", &a, &b);
      if (a == flag) {
        if (vis[a] != 1) flag = b;
      } else if (b == flag) {
        if (vis[b] != 1) flag = a;
      }
    }
    printf("%d\n", flag);
  }
  return 0;
}
