#include <bits/stdc++.h>
using namespace std;
int main(int argc, char **argv) {
  int n;
  scanf("%d", &n);
  map<int, pair<int, int> > mp;
  map<int, int> lng;
  int ai;
  for (int i = 0; i < n; i++) {
    scanf("%d", &ai);
    lng[ai]++;
  }
  int m;
  scanf("%d", &m);
  vector<int> b(m), c(m);
  for (int i = 0; i < m; i++) {
    scanf("%d", &b[i]);
  }
  for (int i = 0; i < m; i++) {
    scanf("%d", &c[i]);
  }
  pair<pair<int, int>, int> best, cur;
  best = make_pair(make_pair(-1, -1), -1);
  for (int i = 0; i < m; i++) {
    cur = make_pair(make_pair(lng[b[i]], lng[c[i]]), i + 1);
    if (cur > best) {
      best = cur;
    }
  }
  printf("%d\n", best.second);
  return 0;
}
