#include <bits/stdc++.h>
using namespace std;
const int maxn = 200000 + 8;
int valb[maxn], valc[maxn];
map<int, int> a;
int main() {
  int n, m, val;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &val);
    a[val]++;
  }
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) scanf("%d", &valb[i]);
  for (int i = 1; i <= m; i++) scanf("%d", &valc[i]);
  int ans = -1, ansx = -1, ansy = -1, x, y;
  for (int i = 1; i <= m; i++) {
    x = a[valb[i]], y = a[valc[i]];
    if (x > ansx || (x == ansx && y > ansy)) {
      ans = i;
      ansx = x;
      ansy = y;
    }
  }
  printf("%d", ans);
  return 0;
}
