#include <bits/stdc++.h>
using namespace std;
bool marr[(int)1e6 + 10] = {0};
int main() {
  int n = ({
    int a;
    scanf("%d", &a);
    a;
  }),
      m = ({
        int a;
        scanf("%d", &a);
        a;
      }),
      k = ({
        int a;
        scanf("%d", &a);
        a;
      });
  int ret = 1;
  for (int i = 0; i < m; i++)
    marr[({
      int a;
      scanf("%d", &a);
      a;
    })] = 1;
  for (int i = 0; i < k; i++) {
    int t1 = ({
      int a;
      scanf("%d", &a);
      a;
    }),
        t2 = ({
          int a;
          scanf("%d", &a);
          a;
        });
    if (marr[ret]) break;
    if (t1 == ret)
      ret = t2;
    else if (t2 == ret)
      ret = t1;
  }
  printf("%d\n", ret);
}
