#include <bits/stdc++.h>
using namespace std;
map<long long, int> cnt;
long long audio[202000], lang[202000];
long long mx = -1e9, fav, vp = -1e9;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    cnt[x]++;
  }
  int m;
  scanf("%d", &m);
  for (int i = 0; i < m; i++) scanf("%d", &audio[i]);
  for (int i = 0; i < m; i++) scanf("%d", &lang[i]);
  for (int i = 0; i < m; i++) {
    long long tmp = cnt[audio[i]];
    if (tmp > vp) {
      vp = tmp;
      mx = cnt[audio[i]] + cnt[lang[i]];
      fav = i + 1;
    } else if (tmp == vp && tmp + cnt[lang[i]] > mx) {
      mx = tmp + cnt[lang[i]];
      fav = i + 1;
    }
  }
  cout << fav << endl;
}
