#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k, ans1 = 0, ans = 1, j = 1;
  cin >> n >> m >> k;
  vector<int> h(n + 1, 0);
  for (int i = 0; i < m; i++) {
    int x;
    cin >> x;
    h[x]++;
  }
  for (int i = 1; i <= k; i++) {
    int x, y;
    cin >> x >> y;
    if (h[ans] == 1 && ans1 == 0) ans1 = ans;
    if (x == ans)
      ans = y;
    else if (y == ans)
      ans = x;
  }
  if (ans1 != 0)
    cout << ans1;
  else
    cout << ans;
  return 0;
}
