#include <bits/stdc++.h>
using namespace std;
map<int, int> cnt;
int b[200003] = {0}, c[200003] = {0};
int mycomp(int i, int j) {
  if (cnt[b[j]] == cnt[b[i]]) return cnt[c[j]] < cnt[c[i]];
  return cnt[b[j]] < cnt[b[i]];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int x;
    cin >> x;
    ++cnt[x];
  }
  int m;
  cin >> m;
  int movie[m + 1];
  for (int i = 0; i < m; ++i) {
    cin >> b[i];
    movie[i] = i;
  }
  for (int i = 0; i < m; ++i) cin >> c[i];
  cout << *min_element(movie, movie + m, mycomp) + 1;
  return 0;
}
