#include <bits/stdc++.h>
using namespace std;
const int MAX = 2e5 + 7;
int n, m;
int a[MAX];
int b[MAX];
int c[MAX];
map<int, int> h;
int m1, m2, ans = 1;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i], h[a[i]]++;
  cin >> m;
  for (int i = 1; i <= m; i++) cin >> b[i];
  for (int i = 1; i <= m; i++) cin >> c[i];
  for (int i = 1; i <= m; i++) {
    int t1, t2;
    t1 = h[b[i]];
    t2 = h[c[i]];
    if (m1 < t1 or (m1 == t1 and m2 < t2)) {
      m1 = t1;
      m2 = t2;
      ans = i;
    }
  }
  cout << ans;
}
