#include <bits/stdc++.h>
using namespace std;
int Bsearch(int a[], int low, int high, int key) {
  int mid = (low + high) / 2;
  while (low <= high) {
    mid = (low + high) / 2;
    if (a[mid] == key)
      return key;
    else if (a[mid] > key)
      high = mid - 1;
    else
      low = mid + 1;
  }
  return -1;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m, k;
  cin >> n >> m >> k;
  int a[m], i;
  int count[1000001];
  for (i = 0; i < 1000001; i++) count[i] = 0;
  for (i = 0; i < m; i++) {
    cin >> a[i];
    count[a[i]]++;
  }
  int ind = 1, flag = 0;
  while (k--) {
    int u, v;
    cin >> u >> v;
    if ((u == ind || v == ind) && !flag && count[ind] == 0) {
      if (u == ind)
        ind = v;
      else
        ind = u;
      if (count[ind] >= 1) flag = 1;
    }
  }
  cout << ind << endl;
  return 0;
}
