#include <bits/stdc++.h>
using namespace std;
const double PI =
    3.14159265358979323846264338327950288419716939937510582097494459230;
const long long MOD = 1e9 + 7;
const long long INF = 1e17;
long long mpow(long long a, long long b) {
  a = a % MOD;
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = (res * a) % MOD;
    a = (a * a) % MOD;
    b = b >> 1;
  }
  return res % MOD;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  cin >> n;
  map<long long, long long> m;
  for (int i = 0; i < (int)(n); ++i) {
    long long x;
    cin >> x;
    m[x]++;
  }
  long long q;
  cin >> q;
  long long x[q], y[q];
  for (int i = 0; i < (int)(q); ++i) cin >> x[i];
  for (int i = 0; i < (int)(q); ++i) cin >> y[i];
  vector<pair<pair<long long, long long>, long long>> ans;
  for (int i = 0; i < (int)(q); ++i) {
    ans.push_back({{m[x[i]], m[y[i]]}, i});
  }
  sort((ans).rbegin(), (ans).rend());
  cout << ans[0].second + 1;
  return 0;
}
