#include <bits/stdc++.h>
using namespace std;
const int N = 5e5;
int a[N], x[N], y[N];
map<int, int> mapp;
int main() {
  int n;
  cin >> n;
  vector<pair<pair<int, int>, int> > v;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    mapp[a[i]]++;
  }
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) cin >> x[i];
  for (int i = 0; i < m; i++) cin >> y[i];
  for (int i = 0; i < m; i++) {
    v.push_back(make_pair(make_pair(mapp[x[i]], mapp[y[i]]), i));
  }
  sort(v.begin(), v.end(), greater<pair<pair<int, int>, int> >());
  cout << v[0].second + 1 << endl;
  return 0;
}
