#include <bits/stdc++.h>
using namespace std;
int n;
map<int, int> M;
int B[201000];
int C[201000];
void add(int x) {
  if (M.find(x) == M.end())
    M[x] = 1;
  else
    ++M[x];
}
int get(int x) {
  if (M.find(x) == M.end())
    return 0;
  else
    return M[x];
}
int main() {
  scanf("%d", &n);
  int a;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a);
    add(a);
  }
  int m;
  scanf("%d", &m);
  int b, c;
  int nr = 0;
  int curb = -1;
  int curc = -1;
  for (int j = 1; j <= m; ++j) scanf("%d", &B[j]);
  for (int j = 1; j <= m; ++j) scanf("%d", &C[j]);
  for (int j = 1; j <= m; ++j) {
    b = B[j];
    c = C[j];
    int gb = get(b);
    int gc = get(c);
    if (gb > curb || (gb == curb && gc > curc)) {
      nr = j;
      curb = gb;
      curc = gc;
    }
  }
  printf("%d\n", nr);
  return 0;
}
