#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m;
  cin >> n;
  long long language[n];
  map<long long, long long> scientist;
  for (long long i = 0; i < n; i++) {
    cin >> language[i];
    scientist[language[i]]++;
  }
  cin >> m;
  long long audio[m + 9], subtitle[m + 9];
  for (long long i = 0; i < m; i++) cin >> audio[i];
  for (long long i = 0; i < m; i++) cin >> subtitle[i];
  vector<pair<long long, long long> > ans;
  for (long long i = 0; i < m; i++)
    ans.push_back(make_pair(scientist[audio[i]], scientist[subtitle[i]]));
  long long pos = 1, j = 0;
  for (long long i = 1; i < m; i++) {
    if (ans[i].first > ans[j].first) {
      j = i;
      pos = j + 1;
    } else if (ans[i].first == ans[j].first && ans[i].second > ans[j].second) {
      j = i;
      pos = j + 1;
    }
  }
  cout << pos;
  return 0;
}
