#include <bits/stdc++.h>
using namespace std;
bool best(vector<int> a, vector<int> b) {
  if (a[2] != b[2])
    return a[2] < b[2];
  else
    return a[3] < b[3];
}
int main() {
  map<int, int> num;
  int n, k, mx = -1;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (num.end() == num.find(a[i])) {
      num.insert(pair<int, int>(a[i], 1));
    } else
      num[a[i]]++;
  }
  cin >> k;
  int s;
  vector<vector<int>> f(k);
  for (int i = 0; i < k; i++) {
    cin >> s;
    f[i].push_back(s);
  }
  for (int i = 0; i < k; i++) {
    cin >> s;
    f[i].push_back(s);
    int l = 0, r = 0;
    if (num.end() != num.find(f[i][0]))
      f[i].push_back(num[f[i][0]]);
    else
      f[i].push_back(0);
    if (num.end() != num.find(f[i][1]))
      f[i].push_back(num[f[i][1]]);
    else
      f[i].push_back(0);
    f[i].push_back(i);
  }
  sort(f.begin(), f.end(), best);
  cout << f[k - 1][4] + 1;
  return 0;
}
