#include <bits/stdc++.h>
using namespace std;
long long n, m;
vector<long long> a, b, c;
void solve() {
  cin >> n;
  map<long long, long long> mapa;
  a.resize(n);
  for (auto& i : a) cin >> i;
  for (auto& i : a) ++mapa[i];
  cin >> m;
  b.resize(m);
  c.resize(m);
  for (auto& i : b) cin >> i;
  for (auto& i : c) cin >> i;
  long long idx = 0;
  for (long long i = 1; i < m; ++i) {
    if (mapa[b[i]] > mapa[b[idx]] ||
        mapa[b[i]] == mapa[b[idx]] && mapa[c[i]] > mapa[c[idx]])
      idx = i;
  }
  cout << idx + 1 << '\n';
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout << fixed << setprecision(20);
  long long t = 1;
  while (t--) solve();
}
