#include <bits/stdc++.h>
using namespace std;
void imprimirVector(vector<long long> v) {
  if (!v.empty()) {
    int p = v.size();
    cout << "[";
    for (int i = 0; i < (int)(p - 1); i++) cout << v[i] << ",";
    cout << v[p - 1] << "]" << endl;
  } else
    cout << "[]" << endl;
}
long long toNumber(string s) {
  long long Number;
  if (!(istringstream(s) >> Number)) Number = 0;
  return Number;
}
string toString(long long number) {
  ostringstream ostr;
  ostr << number;
  return ostr.str();
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  long long n;
  while (cin >> n) {
    map<long long, long long> countA;
    for (int i = 0; i < (int)(n); i++) {
      long long a;
      cin >> a;
      countA[a]++;
    }
    long long m;
    cin >> m;
    pair<long long, long long> bestMovie = make_pair(0, 0);
    long long bestIndice = 1;
    vector<long long> b(m), c(m);
    for (int i = 0; i < (int)(m); i++) cin >> b[i];
    for (int i = 0; i < (int)(m); i++) cin >> c[i];
    for (int i = 0; i < (int)(m); i++) {
      pair<long long, long long> movie = make_pair(countA[b[i]], countA[c[i]]);
      if (movie > bestMovie) {
        bestMovie = movie;
        bestIndice = i + 1;
      }
    }
    cout << bestIndice << "\n";
  }
  return 0;
}
