#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 5;
int n, m, k;
int h[maxn];
int main() {
  cin.sync_with_stdio(false);
  cin.tie(nullptr);
  cin >> n >> m >> k;
  int t;
  for (int i = 0; i < m; i++) {
    cin >> t;
    h[t] = 1;
  }
  int cur = 1;
  int u, v;
  if (h[cur] == 1) {
    cout << cur << endl;
    return 0;
  }
  for (int i = 0; i < k; i++) {
    cin >> u >> v;
    if (u == cur)
      cur = v;
    else if (v == cur)
      cur = u;
    if (h[cur] == 1) {
      cout << cur << endl;
      return 0;
    }
  }
  cout << cur << endl;
  return 0;
}
