#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, k;
  scanf("%d%d%d", &n, &m, &k);
  set<int> q;
  int a;
  for (int i = 0; i < m; i++) {
    scanf("%d", &a);
    q.insert(a);
  }
  int wh = 1;
  int t;
  if (q.find(wh) != q.end())
    t = 1;
  else
    t = 0;
  for (int i = 0; i < k; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    if (!t) {
      if (x == wh) {
        wh = y;
        if (q.find(wh) != q.end()) t = 1;
      } else if (y == wh) {
        wh = x;
        if (q.find(wh) != q.end()) t = 1;
      }
    }
  }
  printf("%d\n", wh);
  return 0;
}
