#include <bits/stdc++.h>
using namespace std;
const int INF = int(1e9);
long long n, m;
pair<long long, long long> p = make_pair(0, 0);
long long b[222222];
long long c[222222];
long long ans;
map<long long, long long> mp;
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    mp[x]++;
  }
  cin >> m;
  for (int i = 1; i <= m; i++) cin >> b[i];
  for (int i = 1; i <= m; i++) cin >> c[i];
  for (int i = 1; i <= m; i++)
    if (p <= make_pair(mp[b[i]], mp[c[i]]))
      ans = i, p = make_pair(mp[b[i]], mp[c[i]]);
  cout << ans;
  return 0;
}
