#include <bits/stdc++.h>
template <typename T, typename U>
static inline void amin(T &first, U second) {
  if (second < first) first = second;
}
template <typename T, typename U>
static inline void amax(T &first, U second) {
  if (first < second) first = second;
}
using namespace std;
void solve() {
  int n, i, m, k;
  cin >> n;
  map<int, int> make_pair;
  int a[n];
  for (i = 0; i < n; i++) cin >> a[i], make_pair[a[i]]++;
  cin >> m;
  int b[m], c[m];
  for (i = 0; i < m; i++) cin >> b[i];
  for (i = 0; i < m; i++) cin >> c[i];
  int ans = make_pair[b[0]];
  int in = 1;
  for (i = 0; i < m; i++) {
    k = make_pair[b[i]];
    if (k > ans) {
      ans = k;
      in = i + 1;
    } else if (k == ans) {
      if (make_pair[c[i]] > make_pair[c[in - 1]]) in = i + 1;
    }
  }
  cout << in;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
