#include <bits/stdc++.h>
using namespace std;
const int maxn = 200100;
const int inf = 0x7f7f7f7f;
const int mod = 1e9 + 7;
long long a[maxn];
long long b[maxn];
long long n, m;
map<long long, long long> mp;
int main() {
  long long x;
  scanf("%lld", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &x);
    mp[x]++;
  }
  scanf("%lld", &m);
  for (int i = 1; i <= m; i++) scanf("%lld", &a[i]);
  for (int i = 1; i <= m; i++) scanf("%lld", &b[i]);
  long long max1 = -1, max2 = -1;
  long long ans;
  for (int i = 1; i <= m; i++) {
    if (mp[a[i]] > max1 || (mp[a[i]] == max1 && mp[b[i]] > max2)) {
      max1 = mp[a[i]];
      max2 = mp[b[i]];
      ans = i;
    }
  }
  printf("%lld\n", ans);
  return 0;
}
