#include <bits/stdc++.h>
using namespace std;
int n, m, k, u, v, y;
int h[1000001];
int main() {
  int x = 1;
  cin >> n >> m >> k;
  for (int i = 0; i < m; i++) {
    cin >> y;
    h[y] = 1;
  }
  for (int i = 0; i < k; i++) {
    scanf("%d", &u);
    scanf("%d", &v);
    if (h[x] != 0) {
      break;
    }
    if (x == u)
      x = v;
    else if (x == v)
      x = u;
  }
  cout << x;
}
