#include <bits/stdc++.h>
using namespace std;
bool h[1000009];
int main() {
  int n, m, k, tmp, tmp1, pos = 1;
  cin >> n >> m >> k;
  for (int i = 0; i < m; ++i) {
    cin >> tmp;
    h[tmp] = true;
  }
  if (h[1]) {
    cout << pos << endl;
    return 0;
  }
  for (int i = 0; i < k; ++i) {
    cin >> tmp >> tmp1;
    if (pos == tmp || tmp1 == pos) {
      pos = (tmp == pos) ? tmp1 : tmp;
      if (h[pos]) break;
    }
  }
  cout << pos << endl;
  return 0;
}
