#include <bits/stdc++.h>
using namespace std;
int sci[200005], bn[200005];
int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    int m, ple = 0, sat = 0, fi = 1, cn;
    map<int, int> mp;
    for (int i = 0; i < n; i++) {
      scanf("%d", &sci[i]);
      mp[sci[i]]++;
    }
    scanf("%d", &m);
    for (int i = 1; i <= m; i++) {
      scanf("%d", &bn[i]);
    }
    for (int i = 1; i <= m; i++) {
      scanf("%d", &cn);
      if (mp[bn[i]] > ple) {
        ple = mp[bn[i]];
        sat = mp[cn];
        fi = i;
      } else if (mp[bn[i]] == ple && mp[cn] > sat) {
        sat = mp[cn];
        fi = i;
      }
    }
    printf("%d\n", fi);
  }
}
