#include <bits/stdc++.h>
using namespace std;
const int N = 2000010;
int n, m, p[N], a[N], b[N];
map<int, int> mp;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &p[i]), mp[p[i]]++;
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) scanf("%d", &a[i]);
  for (int i = 1; i <= m; i++) scanf("%d", &b[i]);
  int ans = 1;
  for (int i = 2; i <= m; i++) {
    if (mp[a[i]] > mp[a[ans]]) ans = i;
    if (mp[a[i]] == mp[a[ans]] && mp[b[i]] > mp[b[ans]]) ans = i;
  }
  printf("%d\n", ans);
  return 0;
}
