#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  long long k;
  cin >> n;
  map<long long, long long> sci;
  for (int i = 0; i < n; i++) {
    cin >> k;
    sci[k]++;
  }
  cin >> m;
  long long a[200005], b[200005];
  for (int i = 0; i < m; i++) cin >> a[i];
  for (int i = 0; i < m; i++) cin >> b[i];
  vector<pair<long long, long long> > v;
  for (int i = 0; i < m; i++) {
    v.push_back(make_pair(a[i], b[i]));
  }
  int pos = 1, j = 0;
  for (int i = 1; i < m; i++) {
    if (sci[v[i].first] > sci[v[j].first]) {
      j = i;
      pos = j + 1;
    }
    if (sci[v[i].first] == sci[v[j].first] &&
        sci[v[i].second] > sci[v[j].second]) {
      j = i;
      pos = j + 1;
    }
  }
  cout << pos << endl;
  return 0;
}
