#include <bits/stdc++.h>
using namespace std;
const long long N = 1e7;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  {
    long long n, m, k;
    cin >> n >> m >> k;
    set<long long> s;
    for (long long i = 0; i < m; i++) {
      long long x;
      cin >> x;
      s.insert(x);
    }
    long long u, v;
    long long cur = 1;
    for (long long i = 0; i < k; i++) {
      cin >> u;
      cin >> v;
      if (s.find(cur) != s.end()) {
        break;
      }
      if (cur == u)
        cur = v;
      else if (cur == v)
        cur = u;
    }
    cout << cur << "\n";
    return 0;
  }
  return 0;
}
