#include <bits/stdc++.h>
using namespace std;
int n, holes, swapping;
bool isHole[1000003];
int bonePos;
int main() {
  while (cin >> n >> holes >> swapping) {
    int x;
    bonePos = 0;
    for (int i = 0; i < holes; i++) {
      scanf("%d", &x);
      isHole[x - 1] = 1;
    }
    int y;
    bool falled = isHole[0];
    for (int i = 0; i < swapping; i++) {
      scanf("%d %d", &x, &y);
      x--, y--;
      if (falled) continue;
      if (bonePos == x)
        bonePos = y;
      else if (bonePos == y)
        bonePos = x;
      if (isHole[bonePos]) falled = 1;
    }
    cout << bonePos + 1 << endl;
  }
  return 0;
}
