#include<iostream>
#include<algorithm>
#include<map>
#include <vector>
using namespace std;
struct Movie{
long long bj;
long long cj;
int32_t scoreb;
int32_t scorec;
};
typedef pair<int, Movie> PAIR;
struct CmpByValue {
bool operator()(PAIR& k1, PAIR& k2) {
if(k2.second.scoreb >= k1.second.scoreb){
if(k2.second.scoreb > k1.second.scoreb){
return false;
}else if(k2.second.scorec >= k1.second.scorec){
return false;
}else{
return true;
}
}else{
return true;
}
}
};
int32_t caculateNum(long long a,long long b[]){
int32_t num = 0;
int32_t n = sizeof(b);
for(int i=0;i<n;i++){
if(b[i] == a){
num++;
}
}
return num;
};
int main()
{
int32_t n,m;
cin >> n;
long long a[n];
for(int i = 0; i < n;i++){
cin >> a[i];
}
cin >> m;
map<int,Movie> strMap;
for(int i = 1; i <= m;i++){
Movie temp;
temp.cj = 0;
temp.bj = 0;
temp.scoreb = 0;
temp.scorec = 0;
cin >> temp.bj;
pair<int,Movie> value(i,temp);
strMap.insert(value);
}
for(int i = 1; i <= m;i++){
map<int,Movie>::iterator iter1;
iter1 = strMap.find(i);
if(iter1 != strMap.end()){
cin >>iter1->second.cj;
}
}
map<int,Movie>::iterator iter1 = strMap.begin();
while(iter1 != strMap.end()){
iter1->second.scoreb = caculateNum(iter1->second.bj,a);
iter1->second.scorec = caculateNum(iter1->second.cj,a);
iter1++;
}
vector<PAIR> name_score_vec(strMap.begin(), strMap.end());
sort(name_score_vec.begin(), name_score_vec.end(), CmpByValue());
cout<<name_score_vec[0].first<<endl;
return 0;
}