#include <bits/stdc++.h>
using namespace std;
long long aud[200010];
long long sub[200010];
map<long long, int> m;
int main() {
  int n, mo;
  int max_pleased = 0;
  int max_satisfied = 0;
  int max_index = 0;
  long long temp;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> temp;
    m[temp]++;
  }
  cin >> mo;
  for (int i = 0; i < mo; i++) {
    cin >> aud[i];
  }
  for (int i = 0; i < mo; i++) {
    cin >> sub[i];
  }
  for (int i = 0; i < mo; i++) {
    if (m[aud[i]] > max_pleased ||
        (m[aud[i]] == max_pleased && m[sub[i]] > max_satisfied)) {
      max_pleased = m[aud[i]];
      max_satisfied = m[sub[i]];
      max_index = i;
    }
  }
  cout << max_index + 1 << endl;
  return 0;
}
