#include <bits/stdc++.h>
using namespace std;
std::map<int, int> Compress;
int alll[1000010];
pair<int, int> ppp[1000010];
int nA[1000010];
vector<pair<int, pair<int, int> > > temp;
int a[1000010];
int main() {
  int N, M, offset = 0;
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) {
    scanf("%d", &a[i]);
    alll[offset++] = a[i];
  }
  scanf("%d", &M);
  for (int i = 1; i <= M; i++) {
    cin >> ppp[i].first;
    alll[offset++] = ppp[i].first;
  }
  for (int i = 1; i <= M; i++) {
    cin >> ppp[i].second;
    alll[offset++] = ppp[i].second;
  }
  sort(alll, alll + offset);
  int counter = 1;
  Compress[alll[0]] = counter++;
  for (int i = 1; i < offset; i++) {
    if (alll[i] != alll[i - 1]) Compress[alll[i]] = counter++;
  }
  memset(nA, 0, sizeof(nA));
  for (int i = 1; i <= N; i++) {
    nA[Compress[a[i]]]++;
  }
  temp.clear();
  for (int i = 1; i <= M; i++) {
    temp.push_back(make_pair(nA[Compress[ppp[i].first]],
                             make_pair(nA[Compress[ppp[i].second]], i)));
  }
  sort(temp.begin(), temp.end());
  cout << temp[temp.size() - 1].second.second << endl;
  return 0;
}
