#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long int n, m, k;
  cin >> n >> m >> k;
  map<long long int, long long int> mapchik;
  long long int a;
  for (long long int i = 0; i < m; i++) {
    cin >> a;
    mapchik[a] = 1;
  }
  long long int ans = 1, b;
  for (long long int i = 0; i < k; i++) {
    cin >> a >> b;
    if (mapchik[ans]) break;
    if (ans != a && ans != b) continue;
    if (ans == a)
      ans = b;
    else
      ans = a;
  }
  cout << ans << "\n";
  return 0;
}
