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