#include <bits/stdc++.h>
using namespace std;
const long long int N = 1e6 + 5;
const long long int INF = 1e18;
const long long int MOD = 1e9 + 7;
int a[N], has[N], hol[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long int n, m, k, u, v;
  cin >> n >> m >> k;
  a[1] = 1;
  long long int last;
  for (long long int i = 1; i <= m; i++) {
    cin >> hol[i];
    has[hol[i]] = 1;
  }
  for (long long int i = 1; i <= k; i++) {
    cin >> u >> v;
    if (has[u] && a[u]) {
      cout << u << endl;
      exit(0);
    }
    if (has[v] && a[v]) {
      cout << v << endl;
      exit(0);
    }
    swap(a[u], a[v]);
    if (has[u] && a[u]) {
      cout << u << endl;
      exit(0);
    }
    if (has[v] && a[v]) {
      cout << v << endl;
      exit(0);
    }
  }
  for (long long int i = 1; i <= n; i++) {
    if (a[i]) {
      cout << i << endl;
      exit(0);
    }
  }
}
