#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 7;
map<int, int> a;
int n, m, x[N], y[N];
int main() {
  cin >> n;
  int p;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &p);
    a[p]++;
  }
  scanf("%d", &m);
  for (int i = 1; i <= m; i++) scanf("%d", &x[i]);
  for (int i = 1; i <= m; i++) scanf("%d", &y[i]);
  int mx = 1;
  for (int i = 2; i <= m; i++) {
    if (a[x[i]] > a[x[mx]] || (a[x[i]] == a[x[mx]] && a[y[i]] > a[y[mx]])) {
      mx = i;
    }
  }
  cout << mx << endl;
}
