#include <bits/stdc++.h>
using namespace std;
int hole[1000002];
int bone[1000002];
int main() {
  int result = 1;
  bone[1] = 1;
  int n, m, K;
  cin >> n >> m >> K;
  for (int i = 1; i <= m; i++) {
    int x;
    cin >> x;
    hole[x] = 1;
  }
  if (hole[1] == 1) {
    cout << "1";
    return 0;
  }
  for (int i = 0; i < K; i++) {
    int j, k;
    cin >> j >> k;
    if (bone[j] == 1) {
      bone[k] = 1;
      bone[j] = 0;
      result = k;
      if (hole[k] == 1) {
        result = k;
        cout << result;
        return 0;
      }
    } else if (bone[k] == 1) {
      bone[j] = 1;
      bone[k] = 0;
      result = j;
      if (hole[j] == 1) {
        result = j;
        cout << result;
        return 0;
      }
    }
  }
  cout << result;
}
