#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
const double eps = 1e-8;
bool hole[1000005];
bool bone[1000005];
int main() {
  int n, m, k;
  cin >> n >> m >> k;
  memset(hole, false, sizeof(hole));
  memset(bone, false, sizeof(bone));
  for (int i = 0; i < m; i++) {
    int x;
    scanf("%d", &x);
    hole[x] = true;
  }
  int ans = 0;
  int idx = 1;
  bone[1] = true;
  if (hole[1]) ans = 1;
  for (int i = 0; i < k; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    if (ans) continue;
    if (bone[x]) {
      bone[y] = true;
      bone[x] = false;
      idx = y;
      if (hole[y]) ans = y;
    } else if (bone[y]) {
      bone[x] = true;
      bone[y] = false;
      idx = x;
      if (hole[x]) ans = x;
    }
  }
  if (ans)
    cout << ans << endl;
  else
    cout << idx << endl;
}
