#include <bits/stdc++.h>
using namespace std;
long long tu[2000001], tu1[2000001];
int main() {
  long long n, m;
  cin >> n;
  long long q;
  map<long long, long long> wp;
  for (long long a = 1; a <= n; a++) {
    scanf("%I64d", &q);
    wp[q]++;
  }
  cin >> m;
  for (long long a = 1; a <= m; a++) scanf("%I64d", &tu[a]);
  for (long long a = 1; a <= m; a++) scanf("%I64d", &tu1[a]);
  long long gx = -1, my = -1;
  long long zuobiao = -1;
  for (long long a = 1; a <= m; a++) {
    if (wp[tu[a]] > gx || wp[tu[a]] >= gx && wp[tu1[a]] >= my) {
      gx = wp[tu[a]];
      zuobiao = a;
      my = wp[tu1[a]];
    }
  }
  cout << zuobiao << endl;
  return 0;
}
