#include <bits/stdc++.h>
int cmpfunc(const void *a, const void *b) { return (*(int *)a - *(int *)b); }
void swap(int *a, int *b);
int main(int argc, char **argv) {
  int n, m, k, i;
  scanf("%d %d %d", &n, &m, &k);
  int hash[1000002] = {0};
  int h;
  for (i = 1; i <= m; i++) {
    scanf("%d", &h);
    hash[h]++;
  }
  int position = 1, u, v;
  if (hash[1] != 0) {
    printf("1\n");
    return 0;
  }
  while (k--) {
    scanf("%d %d", &u, &v);
    if (u == position) {
      position = v;
      if (hash[position] != 0) {
        printf("%d\n", position);
        return 0;
      }
    } else if (v == position) {
      position = u;
      if (hash[position] != 0) {
        printf("%d\n", position);
        return 0;
      }
    }
  }
  printf("%d\n", position);
  return 0;
}
void swap(int *a, int *b) {
  int tmp = *a;
  *a = *b;
  *b = tmp;
}
