#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5;
int au[N], sub[N], n, m, x, pl, sa, in = 1;
map<int, int> pre;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x;
    pre[x]++;
  }
  cin >> m;
  for (int i = 0; i < m; i++) cin >> au[i];
  for (int i = 0; i < m; i++) cin >> sub[i];
  for (int i = 0; i < m; i++) {
    if (pre[au[i]] > pl) {
      pl = pre[au[i]];
      sa = pre[sub[i]];
      in = i + 1;
    } else if (pre[au[i]] == pl) {
      if (pre[sub[i]] > sa) {
        sa = pre[sub[i]];
        in = i + 1;
      }
    }
  }
  cout << in << endl;
  return 0;
}
