#include <bits/stdc++.h>
using namespace std;
const int MAX = 200005;
map<int, int> Map;
struct Node {
  int au, sub;
} node[MAX];
int n, temp, m;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &temp);
    Map[temp]++;
  }
  int m;
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) {
    scanf("%d", &node[i].au);
  }
  int Max1, Max2;
  Max1 = Max2 = 0;
  int id = 1;
  for (int i = 1; i <= m; i++) {
    scanf("%d", &node[i].sub);
    if (Map[node[i].au] > Max1 ||
        (Map[node[i].au] == Max1 && Map[node[i].sub] > Max2)) {
      Max1 = Map[node[i].au];
      Max2 = Map[node[i].sub];
      id = i;
    }
  }
  cout << id << endl;
  return 0;
}
