#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m, k;
  cin >> n >> m >> k;
  map<int, bool> mp;
  for (int i = 0; i < m; i++) {
    int x;
    cin >> x;
    mp[x] = 1;
  }
  int pos = 1;
  int ans = -1;
  if (mp[pos]) {
    cout << 1;
    return 0;
  }
  for (int i = 0; i < k; i++) {
    int x, y;
    cin >> x >> y;
    if (pos == x or pos == y) {
      if (pos != x)
        pos = x;
      else
        pos = y;
      if (mp[pos]) {
        cout << pos;
        return 0;
      }
    }
  }
  cout << pos;
  return 0;
}
