#include <bits/stdc++.h>
using namespace std;
long long mod = 1000000007;
int num[100010];
int main() {
  int n;
  int ara[200010];
  cin >> n;
  map<int, int> mp;
  for (int i = 0; i < n; i++) {
    cin >> ara[i];
    mp[ara[i]]++;
  }
  int m;
  cin >> m;
  int second[200010], as[200010];
  for (int i = 0; i < m; i++) {
    cin >> second[i];
  }
  for (int i = 0; i < m; i++) {
    cin >> as[i];
  }
  int ans = 1;
  int sat = mp[second[0]];
  int asat = mp[as[0]];
  for (int i = 1; i < m; i++) {
    if (mp[second[i]] > sat) {
      ans = i + 1;
      sat = mp[second[i]];
      asat = mp[as[i]];
    }
    if (mp[second[i]] == sat) {
      if (mp[as[i]] > asat) {
        ans = i + 1;
        sat = mp[second[i]];
        asat = mp[as[i]];
      }
    }
  }
  cout << ans;
}
