#include <bits/stdc++.h>
using namespace std;
int a[1000004];
int n, m, k;
int now = 1;
vector<pair<int, int> > l;
int main() {
  int x, y;
  scanf("%d%d%d", &n, &m, &k);
  for (int i = 0; i < m; ++i) {
    scanf("%d", &x);
    a[x] = 1;
  }
  for (int i = 0; i < k; ++i) {
    scanf("%d%d", &x, &y);
    if (a[now] == 1) break;
    if (now == x)
      now = y;
    else if (now == y)
      now = x;
  }
  printf("%d", now);
}
