#include <bits/stdc++.h>
using namespace std;
int n, m, k, id = 1;
int h[1000005], u[300005], v[300005];
bool hole[1000005];
signed main() {
  ios::sync_with_stdio(false);
  cin >> n >> m >> k;
  for (int i = 1; i <= m; i++) {
    cin >> h[i];
    hole[h[i]] = 1;
  }
  for (int i = 1; i <= k; i++) cin >> u[i] >> v[i];
  for (int i = 1; i <= k; i++) {
    if (hole[id]) break;
    if (u[i] == id)
      id = v[i];
    else if (v[i] == id)
      id = u[i];
  }
  cout << id << endl;
  return 0;
}
