#include <bits/stdc++.h>
using namespace std;
const int M = 5e5 + 5;
int n, m, x;
map<int, int> a;
struct cinema {
  int cnt, sum1, sum2;
} ans[M];
bool cmp(cinema a, cinema b) {
  if (a.sum1 == b.sum1)
    return a.sum2 > b.sum2;
  else
    return a.sum1 > b.sum1;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    a[x]++;
  }
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d", &x);
    ans[i].sum1 = a[x];
    ans[i].cnt = i;
  }
  for (int i = 1; i <= m; i++) {
    scanf("%d", &x);
    ans[i].sum2 = a[x];
  }
  sort(ans + 1, ans + m + 1, cmp);
  printf("%d", ans[1].cnt);
  return 0;
}
