#include <bits/stdc++.h>
using namespace std;
bool isHole[1000005];
int main() {
  ios_base ::sync_with_stdio(0);
  int cups, holes, swaps;
  cin >> cups >> holes >> swaps;
  for (int i = 0; i < holes; i++) {
    int x;
    cin >> x;
    isHole[x] = 1;
  }
  int bone = 1;
  for (int i = 0; i < swaps; i++) {
    if (isHole[bone]) break;
    int a, b;
    cin >> a >> b;
    if (bone == a)
      bone = b;
    else if (bone == b)
      bone = a;
    if (isHole[bone]) break;
  }
  cout << bone << endl;
  return 0;
}
