#include <bits/stdc++.h>
using namespace std;
long long MAX = 1e9;
long long MOD = 1e9 + 7;
long long Mod = 1e9 + 7;
double EPS = 0.0001;
long long gcd(long long a, long long b) { return (b == 0 ? a : gcd(b, a % b)); }
long long lcm(long long a, long long b) { return ((a * b) / gcd(a, b)); }
const int dx[] = {1, -1, 0, 0, 0, 0};
const int dy[] = {0, 0, 1, -1, 0, 0};
int main() {
  int ans = 1;
  int n, m, k;
  scanf("%d", &n);
  scanf("%d", &m);
  scanf("%d", &k);
  vector<bool> isHole(n + 1, 0);
  for (long long i = 0; i < m; i++) {
    int tmp;
    scanf("%d", &tmp);
    isHole[tmp] = true;
  }
  for (long long i = 0; i < k; i++) {
    int x, y;
    scanf("%d", &x);
    scanf("%d", &y);
    if (x == ans && !isHole[ans])
      ans = y;
    else if (y == ans && !isHole[ans])
      ans = x;
  }
  cout << ans << endl;
  return 0;
}
