#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7, N = 1e5 + 10;
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  map<ll, ll> cnt;
  ll n;
  cin >> n;
  for (ll i = 0; i < n; i++) {
    ll x;
    cin >> x;
    cnt[x]++;
  }
  cin >> n;
  vector<ll> b(n + 1), c(n + 1);
  for (ll i = 1; i < n + 1; i++) cin >> b[i];
  for (ll i = 1; i < n + 1; i++) cin >> c[i];
  vector<array<ll, 3>> R;
  for (ll i = 1; i < n + 1; i++) {
    R.push_back({cnt[b[i]], cnt[c[i]], i});
  }
  sort(R.begin(), R.end());
  42;
  cout << R.back()[2] << '\n';
  return 0;
}
