#include <bits/stdc++.h>
using namespace std;
const long long OO = 1e8;
const double EPS = (1e-7);
long long n, m, k, x, y, z, f;
vector<long long> h;
int main() {
  f = 1;
  scanf("%I64d", &n), scanf("%I64d", &m), scanf("%I64d", &k);
  for (long long i = 0; i < m; ++i) {
    scanf("%I64d", &x);
    h.push_back(x);
    if (x == 1) {
      cout << 1 << endl;
      return 0;
    }
  }
  sort(h.begin(), h.end());
  for (long long i = 0; i < k; ++i) {
    scanf("%I64d", &y), scanf("%I64d", &z);
    if (y == f) {
      if (binary_search(h.begin(), h.end(), z)) {
        cout << z << endl;
        return 0;
      }
      f = z;
    } else if (z == f) {
      if (binary_search(h.begin(), h.end(), y)) {
        cout << y << endl;
        return 0;
      }
      f = y;
    }
  }
  cout << f << endl;
  return 0;
}
