#include <bits/stdc++.h>
using namespace std;
int n, m, k, a[1000009], b[1000009];
int main() {
  scanf("%d%d%d", &n, &m, &k);
  int i, q = 0, t, l, r;
  for (i = 1; i <= m; i++) {
    scanf("%d", &t);
    b[t] = 1;
  }
  a[1] = 1;
  t = 1;
  if (b[1] == 1) q = 1;
  for (i = 1; i <= k; i++) {
    scanf("%d%d", &l, &r);
    if (a[l] == 1 && b[r] == 1 && q == 0) q = r;
    if (a[r] == 1 && b[l] == 1 && q == 0) q = l;
    if (q == 0) swap(a[l], a[r]);
    if (a[l] == 1) t = l;
    if (a[r] == 1) t = r;
  }
  if (q == 0)
    cout << t;
  else
    cout << q;
}
