#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long int k = 0, m = 0, n = 0, p = 1;
  cin >> k >> m >> n;
  set<long long int> st;
  for (int a = 0; a < m; a++) {
    long long int x = 0;
    cin >> x;
    st.insert(x);
  }
  for (int a = 0; a < n; a++) {
    long long int x = 0, y = 0;
    cin >> x >> y;
    if (st.count(p) != 0) break;
    p == x ? p = y : (p == y ? p = x : p = p);
  }
  cout << p;
}
