#include <bits/stdc++.h>
using namespace std;
struct nod {
  long long int id, pl, st;
  nod() { pl = st = 0; }
  bool operator<(const nod& autre) const {
    if (pl == autre.pl)
      return st > autre.st;
    else
      return pl > autre.pl;
  }
} m[200 * 1000 + 5];
long long int n, a, b, c, p;
map<long long int, long long int> s;
int main() {
  cin >> n;
  while (n--) {
    cin >> a;
    if (s[a] == false)
      s[a] = 1;
    else
      s[a]++;
  }
  cin >> p;
  for (int i = 0; i < p; i++) {
    m[i].id = i + 1;
    cin >> b;
    if (s[b] != false) m[i].pl = s[b];
  }
  for (int i = 0; i < p; i++) {
    cin >> b;
    if (s[b] != false) m[i].st = s[b];
  }
  sort(m, m + p);
  cout << m[0].id;
  return 0;
}
