#include <bits/stdc++.h>
using namespace std;
int inf = std::numeric_limits<int>().max();
int main() {
  int n, m, k, u, v;
  set<int> holes;
  scanf("%d %d %d", &n, &m, &k);
  for (int i = 1; i <= m; i++) {
    scanf("%d", &v);
    holes.insert(v);
  }
  int osso = 1;
  for (int i = 1; i <= k; i++) {
    scanf("%d %d", &u, &v);
    if (u == osso && !holes.count(u)) {
      osso = v;
    } else if (v == osso && !holes.count(v)) {
      osso = u;
    }
    if (holes.count(osso)) {
      printf("%d\n", osso);
      return 0;
    }
  }
  printf("%d\n", osso);
  return 0;
}
