#include <bits/stdc++.h>
const int maxn = 212343;
using namespace std;
int n, w, m;
struct moive {
  int au, sub;
} a[maxn + 10];
int main() {
  while (scanf("%d", &n) != EOF) {
    map<int, int> ma;
    for (int i = 0; i < n; i++) {
      scanf("%d", &w);
      ma[w]++;
    }
    scanf("%d", &m);
    for (int i = 1; i <= m; i++) {
      scanf("%d", &a[i].au);
    }
    for (int i = 1; i <= m; i++) {
      scanf("%d", &a[i].sub);
    }
    int ans = 0, res = -0x3f3f3f3f, res1 = -0x3f3f3f3f;
    for (int i = 1; i <= m; i++) {
      if (ma[a[i].au] > res) {
        ans = i;
        res = ma[a[i].au];
        res1 = ma[a[i].sub];
        continue;
      }
      if (ma[a[i].au] == res) {
        if (ma[a[i].sub] < res1)
          continue;
        else {
          ans = i;
          res = ma[a[i].au];
          res1 = ma[a[i].sub];
        }
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}
