#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  int n, m, k;
  cin >> n >> m >> k;
  set<int> holes;
  for (int i = (0); i < (m); i++) {
    int a;
    cin >> a;
    holes.insert(a);
  }
  vector<pair<int, int> > arr(k);
  int ball = 1;
  if (holes.find(ball) != holes.end()) {
    cout << 1 << '\n';
    return 0;
  }
  for (int i = (0); i < (k); i++) {
    int a, b;
    cin >> a >> b;
    if (a == ball) {
      ball = b;
    } else if (b == ball) {
      ball = a;
    }
    if (holes.find(ball) != holes.end()) {
      cout << ball << '\n';
      return 0;
    }
  }
  cout << ball << '\n';
  return 0;
}
