#include <bits/stdc++.h>
using namespace std;
const int INF = 1 << 30;
struct Node {
  int f, s, pos;
  Node() {}
  bool operator<(const Node &n) const { return f > n.f || f == n.f && s > n.s; }
};
int main() {
  int n;
  scanf("%d", &n);
  map<int, int> sc;
  int t;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &t);
    sc[t]++;
  }
  int m;
  scanf("%d", &m);
  vector<Node> s(m);
  for (int i = 0; i < m; ++i) {
    scanf("%d", &t);
    s[i].f = sc[t];
    s[i].pos = i + 1;
  }
  for (int i = 0; i < m; ++i) {
    scanf("%d", &t);
    s[i].s = sc[t];
  }
  sort(s.begin(), s.end());
  printf("%d", s[0].pos);
  return 0;
}
