#include <bits/stdc++.h>
using namespace std;
int n, m;
const int N = 200010, M = 200010;
map<int, int> p;
int peiyin[M], zimu[M];
int read() {
  char ch = getchar();
  int x = 0, f = 1;
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while ('0' <= ch && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
void write(int x) {
  if (x < 0) x *= -1, putchar('-');
  if (x > 9) write(x / 10);
  putchar(x % 10 + '0');
}
int main() {
  int x;
  int ans_pei = -10, ans_man = -10, number = 0;
  n = read();
  for (int i = 1; i <= n; i++) {
    x = read();
    p[x]++;
  }
  m = read();
  for (int i = 1; i <= m; i++) {
    peiyin[i] = read();
  }
  for (int i = 1; i <= m; i++) {
    zimu[i] = read();
  }
  for (int i = 1; i <= m; i++) {
    if (p[peiyin[i]] > ans_pei)
      number = i, ans_pei = p[peiyin[i]], ans_man = p[zimu[i]];
    else if (p[peiyin[i]] == ans_pei && p[zimu[i]] > ans_man)
      number = i, ans_man = p[zimu[i]];
  }
  write(number);
  return 0;
}
