#include <bits/stdc++.h>
using namespace std;
const int MAXN = 600010;
int mem[MAXN], lan[MAXN], accept[MAXN], like[MAXN], b[MAXN];
int cnt[MAXN];
int n, m, tmp, t;
void discrete() {
  for (int i = 1; i <= tmp; i++) b[i] = lan[i];
  sort(b + 1, b + tmp + 1);
  t = unique(b + 1, b + tmp + 1) - b - 1;
}
int query(int x) { return lower_bound(b + 1, b + 1 + t, x) - b; }
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> mem[i];
    lan[++tmp] = mem[i];
  }
  cin >> m;
  for (int i = 1; i <= m; i++) {
    cin >> like[i];
    lan[++tmp] = like[i];
  }
  for (int i = 1; i <= m; i++) {
    cin >> accept[i];
    lan[++tmp] = accept[i];
  }
  discrete();
  for (int i = 1; i <= n; i++) cnt[query(mem[i])]++;
  int ans = 1, max1 = 0, max2 = 0;
  for (int i = 1; i <= m; i++) {
    int x = cnt[query(like[i])], y = cnt[query(accept[i])];
    if (x > max1 || x == max1 && y > max2) {
      ans = i;
      max1 = x;
      max2 = y;
    }
  }
  printf("%d\n", ans);
  return 0;
}
