#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = (x << 1) + (x << 3) + ch - 48;
    ch = getchar();
  }
  return x * f;
}
const long long N = 2e5 + 10;
map<long long, long long> a;
struct data {
  long long x;
  long long y;
  long long num;
} cnt[N];
bool cmp(data x, data y) {
  if (x.x != y.x) return x.x > y.x;
  return x.y > y.y;
}
signed main() {
  long long n = read();
  for (register long long i = 1; i <= n; i++) {
    long long x = read();
    a[x]++;
  }
  long long m = read();
  for (register long long i = 1; i <= m; i++) {
    long long x = read();
    cnt[i].x += a[x];
    cnt[i].num = i;
  }
  for (register long long i = 1; i <= m; i++) {
    long long x = read();
    cnt[i].y += a[x];
  }
  sort(cnt + 1, cnt + 1 + m, cmp);
  cout << cnt[1].num << endl;
  return 0;
}
