#include <bits/stdc++.h>
using namespace std;
int maxi(long long int a, long long int b) { return (a > b ? a : b); }
int mini(long long int a, long long int b) { return (a < b ? a : b); }
int prime[1000001] = {0};
void sieve_of_erastosthenes(long long int n) {
  long long int p;
  for (p = 2; p * p <= n; p++) {
    if (prime[p] == 0) {
      for (long long int i = p * 2; i <= n; i += p) prime[i] = 1;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m, k;
  int x, y;
  cin >> n >> m >> k;
  int a[1000001] = {0};
  for (int i = 0; i < m; i++) {
    cin >> x;
    a[x] = 1;
  }
  int pos = 1;
  if (a[pos] == 1) {
    cout << pos;
    return 0;
  }
  for (int i = 0; i < k; i++) {
    cin >> x >> y;
    if (x == pos)
      pos = y;
    else if (y == pos)
      pos = x;
    if (a[pos] == 1) {
      cout << pos;
      return 0;
    }
  }
  cout << pos;
  return 0;
}
