#include <bits/stdc++.h>
using namespace std;
int n, m;
int a[200010], b[200010], c[200010];
int f[200010];
struct language {
  int t1, t2, id;
};
language t[200100];
map<int, int> ma;
bool cmp(const language &x, const language &y) {
  return x.t1 > y.t1 || x.t1 == y.t1 && x.t2 > y.t2;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    ma[a[i]]++;
  }
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d", &b[i]);
    t[i].t1 = ma[b[i]];
    t[i].id = i;
  }
  for (int i = 1; i <= m; i++) {
    scanf("%d", &c[i]);
    t[i].t2 = ma[c[i]];
  }
  sort(t + 1, t + 1 + m, cmp);
  printf("%d", t[1].id);
}
