#include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int scientist[200010];
struct video{
int first,last;
}c[200010];
int point[600010][2];
int main()
{
int n;
cin >> n;
int p=0;
for (int i = 1; i <= n; i ++ ){
scanf("%d", &scientist[i]);
point[p++][0]=scientist[i];
}
int m;
cin >> m;
for (int i = 1; i <= n; i ++ ){
scanf("%d",&c[i].first);
point[p++][0]=c[i].first;
}
for (int i = 1; i <= n; i ++ ){
scanf("%d",&c[i].last);
point[p++][0]=c[i].last;
}
sort(point,point+p);
int numofpoint=unique(point,point+p)-point;
for (int i = 0; i < n; i ++ ){
point[lower_bound(point,point+numofpoint,scientist[i])][1]++;
}
int maxha=-1;
int th;
for (int i = 0; i < n; i ++ ){
if(point[lower_bound(point,point+numofpoint,c[i].first)][1]==maxha){
if((point[lower_bound(point,point+numofpoint,c[i].first)][1])>(point[lower_bound(point,point+numofpoint,c[th].first)][1])){
th=i;
continue;
}
}else if(point[lower_bound(point,point+numofpoint,c[i].first)][1]>maxha)th=i;
}
cout << th;
}