#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
const int mod = 998244353;
int c, h, m;
bool hp[N];
int main() {
  scanf("%d %d %d", &c, &h, &m);
  int x, y;
  for (int i = 0; i < h; i++) {
    scanf("%d", &x);
    hp[x] = true;
  }
  int pos = 1;
  for (int i = 0; i < m; i++) {
    scanf("%d %d", &x, &y);
    if (pos == x || pos == y) {
      if (hp[pos]) {
        break;
      }
      pos = abs(pos - x - y);
      if (hp[pos]) {
        break;
      }
    } else
      continue;
  }
  printf("%d\n", pos);
}
