#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  map<int, int> mp;
  for (int i = 0; i < int(n); i++) {
    int x;
    cin >> x;
    mp[x]++;
  }
  int m;
  cin >> m;
  int maxs = -1;
  int maxa = -1;
  int ans = 0;
  vector<int> b(m);
  vector<int> c(m);
  for (int i = 0; i < int(m); i++) cin >> b[i];
  for (int i = 0; i < int(m); i++) cin >> c[i];
  for (int i = 0; i < int(m); i++) {
    int x = b[i];
    int y = c[i];
    if (mp[x] > maxs || (mp[x] == maxs && mp[y] > maxa)) {
      ans = i + 1;
      maxs = mp[x];
      maxa = mp[y];
    }
  }
  cout << ans << endl;
}
