#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
struct movie {
  int ind, sa, asa;
} mm;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  map<int, int> mp;
  for (int i = 0; i < n; i++) {
    int nt;
    cin >> nt;
    mp[nt] += 1;
  }
  int m;
  cin >> m;
  vector<movie> vt(m);
  for (int i = 1; i <= m; i++) {
    int m1;
    cin >> m1;
    vt[i - 1].sa = -mp[m1];
    vt[i - 1].ind = i;
  }
  for (int i = 1; i <= m; i++) {
    int m2;
    cin >> m2;
    vt[i - 1].asa = -mp[m2];
  }
  sort(begin(vt), end(vt), [](movie x, movie y) {
    if (x.sa == y.sa) {
      return x.asa < y.asa;
    }
    return x.sa < y.sa;
  });
  cout << vt[0].ind << endl;
}
