#include <bits/stdc++.h>
using namespace std;
int arr[1000005];
int n, m, k;
int main() {
  scanf("%d%d%d", &n, &m, &k);
  memset(arr, 0, sizeof arr);
  for (int i = 0; i < m; ++i) {
    int number;
    scanf("%d", &number);
    arr[number] = 1;
  }
  bool flg = 0;
  int where = 1;
  if (arr[where] == 1) flg = 1;
  while (k--) {
    int num1, num2;
    scanf("%d%d", &num1, &num2);
    if (num1 == where && !flg) {
      where = num2;
      if (arr[where] == 1) flg = 1;
    } else if (num2 == where && !flg) {
      where = num1;
      if (arr[where] == 1) flg = 1;
    }
  }
  printf("%d", where);
  return 0;
}
