#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, q, c;
  scanf("%d", &n);
  map<int, int> a;
  vector<pair<pair<int, int>, int> > vp;
  for (int i = 0; i < n; i++) {
    scanf("%d", &q);
    a[q]++;
  }
  scanf("%d", &m);
  int b[m];
  for (int i = 0; i < m; i++) scanf("%d", &b[i]);
  for (int i = 0; i < m; i++) {
    scanf("%d", &c);
    vp.push_back({{a[b[i]], a[c]}, i + 1});
  }
  sort(vp.begin(), vp.end());
  cout << vp[m - 1].second << endl;
}
