#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
map<int, int> a;
int x[N], y[N];
int main() {
  int n, m, c, ans;
  while (~scanf("%d", &n)) {
    a.clear();
    for (int i = 1; i <= n; i++) {
      scanf("%d", &c);
      a[c]++;
    }
    scanf("%d", &m);
    for (int i = 1; i <= m; i++) {
      scanf("%d", &x[i]);
    }
    for (int i = 1; i <= m; i++) {
      scanf("%d", &y[i]);
    }
    ans = 1;
    for (int i = 2; i <= m; i++) {
      if (a[x[i]] > a[x[ans]])
        ans = i;
      else if (a[x[i]] == a[x[ans]] && a[y[i]] > a[y[ans]])
        ans = i;
    }
    printf("%d\n", ans);
  }
  return 0;
}
