#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int maxi = 0, maxi1 = 0, pos = 0, n, m;
  cin >> n;
  std::map<long long int, long long int> map;
  for (long long int i = 0; i < n; i++) {
    long long int x;
    cin >> x;
    map[x]++;
  }
  cin >> m;
  std::vector<vector<long long int> > v(m, vector<long long int>(3, 0));
  for (long long int i = 0; i < m; i++) {
    cin >> v[i][0];
    v[i][0] = map[v[i][0]];
    v[i][2] = i;
  }
  for (long long int i = 0; i < m; i++) {
    cin >> v[i][1];
    v[i][1] = map[v[i][1]];
  }
  for (long long int i = 0; i < m; i++) {
    if (v[i][0] > maxi) {
      maxi = v[i][0];
      maxi1 = v[i][1];
      pos = v[i][2];
    } else if (v[i][0] == maxi && v[i][1] > maxi1) {
      maxi1 = v[i][1];
      pos = v[i][2];
    }
  }
  cout << pos + 1;
}
