#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  map<int, int> mp;
  int j;
  for (j = 0; j < n; j++) {
    int x;
    cin >> x;
    mp[x]++;
  }
  int m;
  cin >> m;
  int mat[m][2];
  for (j = 0; j < m; j++) {
    cin >> mat[j][0];
  }
  for (j = 0; j < m; j++) {
    cin >> mat[j][1];
  }
  int p = -1, s = -1;
  int index = 1;
  for (j = 0; j < m; j++) {
    int p1 = mp[mat[j][0]];
    int s1 = mp[mat[j][1]];
    if (p1 > p) {
      index = j + 1;
      p = p1;
      s = s1;
    } else if (p1 == p && s1 > s) {
      index = j + 1;
      p = p1;
      s = s1;
    }
  }
  cout << index << endl;
}
