#include <bits/stdc++.h>
using namespace std;
int vis[1000005];
int main() {
  int n, m, k;
  while (cin >> n >> m >> k) {
    memset(vis, 0, sizeof(vis));
    int i, a, b, index = 1;
    for (i = 0; i < m; i++) {
      scanf("%d", &a);
      vis[a] = 1;
    }
    for (i = 0; i < k; i++) {
      scanf("%d%d", &a, &b);
      if (vis[index] == 1) continue;
      if (a == index)
        index = b;
      else if (b == index)
        index = a;
    }
    cout << index << endl;
  }
  return 0;
}
