#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 5;
long long a[maxn];
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  int n, m, k;
  cin >> n >> m >> k;
  for (int i = 0; i < m; i++) {
    cin >> a[i];
    if (a[i] == 1) {
      cout << "1";
      return 0;
    }
  }
  sort(a, a + m);
  int temp = 1;
  while (k--) {
    int x, y;
    cin >> x >> y;
    if (temp == x && binary_search(a, a + m, y)) {
      temp = y;
      break;
    }
    if (temp == y && binary_search(a, a + m, x)) {
      temp = x;
      break;
    }
    if (x == temp && y != temp)
      temp = y;
    else if (y == temp && x != temp)
      temp = x;
  }
  cout << temp;
  return 0;
}
