#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int> > v(1000005);
int h[1000005];
int main() {
  int n, m, k;
  scanf("%d %d %d", &n, &m, &k);
  int temp;
  for (int i = 0; i < m; i++) {
    scanf("%d", &temp);
    temp--;
    h[temp] = 1;
  }
  int t1, t2;
  v.resize(k);
  int pos = 0;
  for (int i = 0; i < k; i++) {
    scanf("%d %d", &t1, &t2);
    t1--;
    t2--;
    v[i] = make_pair(t1, t2);
  }
  for (int i = 0; i < k; i++) {
    if (h[pos] == 1)
      break;
    else if (v[i].first == pos)
      pos = v[i].second;
    else if (v[i].second == pos)
      pos = v[i].first;
  }
  printf("%d", pos + 1);
}
