#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  long long n, i, j, ans = 0, mx = 0, m;
  map<long long, long long> mx1, mx2;
  vector<long long> cntlst, b, c, lang;
  cin >> n;
  lang.resize(n);
  for (i = 0; i < n; i++) {
    cin >> lang[i];
  }
  for (i = 0; i < n; i++) mx1[lang[i]]++;
  cin >> m;
  b.resize(m);
  c.resize(m);
  for (i = 0; i < m; i++) {
    cin >> b[i];
  }
  for (i = 0; i < m; i++) cin >> c[i];
  for (i = 0; i < m; i++) {
    if (mx1[b[i]] > mx) {
      cntlst.clear();
      cntlst.push_back(i);
      mx = mx1[b[i]];
    } else if (mx1[b[i]] == mx)
      cntlst.push_back(i);
  }
  if (cntlst.size() == 1) {
    cout << cntlst[0] + 1;
    return 0;
  }
  mx = 0;
  for (j = 0; j < cntlst.size(); j++) {
    if (mx1[c[cntlst[j]]] >= mx) {
      ans = cntlst[j] + 1;
      mx = mx1[c[cntlst[j]]];
    }
  }
  cout << ans;
  return 0;
}
