#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
map<long long, long long> mp;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n, m;
  cin >> n;
  vector<long long> v(n);
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
    if (mp.find(v[i]) == mp.end())
      mp[v[i]] = 1;
    else
      mp[v[i]]++;
  }
  cin >> m;
  vector<long long> a(m), b(m);
  for (int i = 0; i < m; ++i) cin >> a[i];
  for (int i = 0; i < m; ++i) cin >> b[i];
  vector<pair<long long, pair<long long, long long> > > vp;
  for (int i = 0; i < m; ++i) {
    vp.push_back({mp[a[i]], {mp[b[i]], i}});
  }
  sort(vp.begin(), vp.end());
  int ans = vp.size() - 1;
  while (ans > 0 && vp[ans].first == vp[ans - 1].first &&
         vp[ans].second.first == vp[ans - 1].second.first)
    ans--;
  cout << vp[ans].second.second + 1 << "\n";
  return 0;
}
