#include <bits/stdc++.h>
using namespace std;
const int N = 200010;
int a[N], b[N], ind[N], cnt = -1;
int n, x[N], y[N], m;
int main() {
  scanf("%d", &n);
  int s;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  sort(a + 1, a + 1 + n);
  int pre = -1, tt = 0;
  for (int i = 1; i <= n; i++) {
    if (pre != a[i]) {
      b[++cnt] = tt;
      tt = 1;
      ind[cnt] = pre;
      pre = a[i];
    } else
      tt++;
  }
  ind[++cnt] = pre;
  b[cnt] = tt;
  scanf("%d", &m);
  int ans = 1, mx = 0, my = 0;
  for (int i = 1; i <= m; i++) scanf("%d", &x[i]);
  for (int i = 1; i <= m; i++) {
    scanf("%d", &y[i]);
    int xx = lower_bound(ind + 1, ind + 1 + cnt, x[i]) - ind;
    int yy = lower_bound(ind + 1, ind + 1 + cnt, y[i]) - ind;
    int px, py;
    if (ind[xx] != x[i])
      px = 0;
    else
      px = b[xx];
    if (ind[yy] != y[i])
      py = 0;
    else
      py = b[yy];
    if (px > mx) {
      ans = i;
      mx = px;
      my = py;
    } else if (px == mx && py > my) {
      ans = i;
      mx = px;
      my = py;
    }
  }
  printf("%d", ans);
  return 0;
}
