#include <bits/stdc++.h>
using namespace std;
const int MX = 1e6 + 1;
int main() {
  ios::sync_with_stdio(false);
  int n, m, k, visit[MX], bone = 1;
  cin >> n >> m >> k;
  memset(visit, 0, sizeof visit);
  for (int i = 0; i < m; i++) {
    int h;
    cin >> h;
    visit[h] = true;
  }
  for (int i = 0; i < k; i++) {
    int u, v;
    cin >> u >> v;
    if (u == bone && (!visit[u]))
      bone = v;
    else if (v == bone && (!visit[v]))
      bone = u;
  }
  cout << bone << endl;
  return 0;
}
