#include <bits/stdc++.h>
using namespace std;
int N, M, mova[200005], movs[200005];
map<int, int> lang;
int read() {
  int r = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') ch = getchar();
  while (ch >= '0' && ch <= '9') r = r * 10 + ch - '0', ch = getchar();
  return r;
}
int main() {
  N = read();
  for (int i = 1; i <= N; i++) lang[read()] += 1;
  M = read();
  for (int i = 1; i <= M; i++) mova[i] = read();
  for (int i = 1; i <= M; i++) movs[i] = read();
  int bestI = 1, bestP = 0, bestS = 0;
  for (int i = 1; i <= M; i++) {
    int a = lang[mova[i]], s = lang[movs[i]];
    if (a == bestP && s > bestS)
      bestI = i, bestS = s;
    else if (a > bestP)
      bestI = i, bestP = a, bestS = s;
  }
  printf("%d", bestI);
  return 0;
}
