#include <bits/stdc++.h>
using namespace std;
int n, m;
struct Person {
  int say;
} persons[200010];
struct Film {
  int audio, sub, id;
} films[200010];
map<int, int> ma;
int main() {
  scanf("%d", &n);
  ma.clear();
  memset(persons, 0, sizeof(persons));
  memset(films, 0, sizeof(films));
  for (int i = 1; i <= n; i++) {
    scanf("%d", &persons[i].say);
    ma[persons[i].say]++;
  }
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d", &films[i].audio);
    films[i].id = i;
  }
  for (int i = 1; i <= m; i++) scanf("%d", &films[i].sub);
  Film ans = films[1];
  for (int i = 2; i <= m; i++) {
    if (ma[ans.audio] < ma[films[i].audio])
      ans = films[i];
    else if (ma[ans.audio] == ma[films[i].audio] &&
             ma[ans.sub] < ma[films[i].sub])
      ans = films[i];
  }
  cout << ans.id << endl;
}
