#include <bits/stdc++.h>
using namespace std;
map<long long, long long> lan;
vector<pair<long long, long long> > mo;
int main() {
  int n, m;
  cin >> n;
  long long x;
  for (int i = 0; i < n; i++) {
    cin >> x;
    lan[x]++;
  }
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> x;
    mo.push_back(make_pair(x, 0));
  }
  for (int i = 0; i < m; i++) {
    cin >> mo[i].second;
  }
  int ma = mo[0].first, maa = mo[0].second, p = 0;
  for (int i = 1; i < m; i++) {
    if (lan[mo[i].first] > lan[ma]) {
      ma = mo[i].first;
      maa = mo[i].second;
      p = i;
    } else if (lan[mo[i].first] == lan[ma]) {
      if (lan[mo[i].second] > lan[maa]) {
        ma = mo[i].first;
        maa = mo[i].second;
        p = i;
      }
    }
  }
  cout << p + 1;
}
