#include <bits/stdc++.h>
using namespace std;
int n, m, k, ho[9900000], pos = 1, o, s, q = 0;
inline int read() {
  register int x = 0, f = 0;
  register char ch = getchar();
  while (ch < '0' || ch > '9') f |= ch == '-', ch = getchar();
  while (ch >= '0' && ch <= '9')
    x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
  return f ? -x : x;
}
inline int che(int x) {
  if (ho[x] == 1) {
    cout << pos;
    exit(0);
  }
  return 1;
}
int main() {
  cin >> n >> m >> k;
  for (int i = 0; i < m; i++) ho[read()] = 1;
  int i = 0;
  while (che(pos) && i < k) {
    i++;
    o = read();
    s = read();
    if (o == pos)
      pos = s;
    else if (pos == s)
      pos = o;
  }
  cout << pos;
}
