#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x;
  cin >> n;
  vector<int> lan, aud, sub;
  map<int, int> lng;
  for (int i = 0; i < n; i++) {
    cin >> x;
    lan.push_back(x);
    lng[x]++;
  }
  int m;
  cin >> m;
  for (int i = 0; i < m; i++) {
    cin >> x;
    aud.push_back(x);
  }
  map<int, pair<int, int>> mapy;
  for (int i = 0; i < m; i++) {
    cin >> x;
    sub.push_back(x);
    mapy[i + 1] = make_pair(aud[i], x);
  }
  auto it = mapy.begin();
  for (auto itr = mapy.begin(); itr != mapy.end(); itr++) {
    if (lng[itr->second.first] > lng[it->second.first]) {
      it = itr;
    } else if (lng[itr->second.first] == lng[it->second.first]) {
      if (lng[itr->second.second] > lng[it->second.second]) it = itr;
    }
  }
  cout << it->first;
}
