#include <bits/stdc++.h>
using namespace std;
int marker[1000000 + 7];
int main() {
  int n, h, k;
  scanf("%d %d %d", &n, &h, &k);
  int t;
  for (int i = 0; i < h; i++) {
    scanf("%d", &t);
    marker[t] = 1;
  }
  int a, b;
  int pos = 1;
  for (int i = 0; i < k; i++) {
    scanf("%d %d", &a, &b);
    if (pos == a && !marker[a])
      pos = b;
    else if (pos == b && !marker[b])
      pos = a;
  }
  if (marker[1]) {
    printf("1\n");
  } else {
    printf("%d\n", pos);
  }
}
