#include <bits/stdc++.h>
using namespace std;
int n, m, k;
int a[1000001];
bool ad[1000001];
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> m >> k;
  int temp;
  for (temp = 0; temp < m; temp++) {
    int x;
    cin >> x;
    ad[x] = true;
  }
  a[1] = 1;
  if (ad[1]) {
    cout << 1 << "\n";
    return 0;
  }
  for (temp = 0; temp < k; temp++) {
    int x, y;
    cin >> x >> y;
    swap(a[x], a[y]);
    if ((a[x] == 1) && (ad[x])) {
      cout << x << "\n";
      return 0;
    }
    if ((a[y] == 1) && (ad[y])) {
      cout << y << "\n";
      return 0;
    }
  }
  for (temp = 1; temp <= n; temp++) {
    if (a[temp] == 1) {
      cout << temp << "\n";
      return 0;
    }
  }
}
