#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:102400000,102400000")
using namespace std;
template <class T>
inline bool rd(T &n) {
  char c;
  int s;
  if (c = getchar(), c == EOF) return 0;
  while (c != '-' && (c < '0' || c > '9')) c = getchar();
  s = (c == '-') ? -1 : 1;
  n = (c == '-') ? 0 : (c - '0');
  while (c = getchar(), c >= '0' && c <= '9') n = n * 10 + (c - '0');
  n *= s;
  return 1;
}
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
template <class T>
T lcm(T a, T b) {
  return a / gcd(a, b) * b;
}
template <class T>
T _abs(T a) {
  return a > 0 ? a : -a;
}
int a[1000006];
int main() {
  int n, m, k;
  while (cin >> n >> m >> k) {
    int i;
    memset(a, 0, sizeof(a));
    int x;
    for (i = 0; i < m; i++) {
      rd(x);
      a[x] = 1;
    }
    int u, v;
    int lo = 1;
    int f = 0;
    if (a[1]) f = 1;
    for (i = 0; i < k; i++) {
      rd(u);
      rd(v);
      if (f) continue;
      if (u == lo) {
        if (a[v] == 1) {
          lo = v;
          f = 1;
        } else {
          lo = v;
        }
      } else if (v == lo) {
        if (a[u] == 1) {
          lo = u;
          f = 1;
        } else {
          lo = u;
        }
      }
    }
    printf("%d\n", lo);
  }
}
