#include <bits/stdc++.h>
using namespace std;
int vis[1000050];
int a[1000050];
int main() {
  int n, m, k;
  while (~scanf("%d%d%d", &n, &m, &k)) {
    memset(vis, 0, sizeof(vis));
    for (int i = 0; i < m; i++) {
      int x;
      scanf("%d", &x);
      vis[x] = 1;
    }
    int ans = 1;
    while (k--) {
      int x, y;
      scanf("%d%d", &x, &y);
      if (x == ans) {
        if (vis[x] != 1) ans = y;
      } else if (y == ans) {
        if (vis[y] != 1) ans = x;
      }
    }
    printf("%d\n", ans);
  }
}
