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