#include <bits/stdc++.h>
using namespace std;
int n, m, k;
int poz = 1;
int hole[1000002];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m >> k;
  for (int i = 1; i <= m; ++i) {
    int x;
    cin >> x;
    hole[x] = 1;
  }
  if (hole[1] == 1) {
    cout << "1";
    return 0;
  }
  for (int i = 1; i <= k; ++i) {
    int u, v;
    cin >> u >> v;
    if (poz == u)
      poz = v;
    else if (poz == v)
      poz = u;
    if (hole[poz] == 1) {
      cout << poz;
      return 0;
    }
  }
  cout << poz;
  return 0;
}
