#include <bits/stdc++.h>
using namespace std;
const int inf = 0x3f3f3f3f;
const int N = 1e6 + 5;
int n, m, k;
bool vis[N];
int main() {
  ios::sync_with_stdio(false);
  cin >> n >> m >> k;
  int h;
  for (int i = 1; i <= m; i++) {
    cin >> h;
    vis[h] = 1;
  }
  bool fg = 0;
  int bone = 1;
  if (vis[bone]) fg = 1;
  for (int i = 1; i <= k; i++) {
    int u, v;
    cin >> u >> v;
    if ((u == bone || v == bone) && !fg) {
      bone = (bone == u) ? v : u;
      if (vis[bone]) fg = 1;
    }
  }
  cout << bone << endl;
  return 0;
}
