include[HTML_REMOVED]
define debug(a) cout <<”###”<< a << endl;
using namespace std;
struct movie {
int id;
int q1;
int q2;
};
bool cmp(movie a, movie b) {
if (a.q1 == b.q1)return a.q2 > b.q2;
return a.q1 > b.q1;
}
int main() {
int n;cin>>n;
map[HTML_REMOVED]lp;
while(n–){int a;cin>>a;lp[a];}
vector[HTML_REMOVED]v1,v2;
int m;cin>>m;
for (int i=0;i[HTML_REMOVED]>b;v1.push_back(b);}
for (int i=0;i[HTML_REMOVED]>b;v2.push_back(b);}
vector[HTML_REMOVED]v;
for (int i=0;i<m;i) {
movie m;
m.id=i+1;
if (lp.count(v1[i]))
m.q1=lp[v1[i]];
else m.q1=-1;
m.q2=lp[v2[i]];
v.push_back(m);
}
sort(v.begin(),v.end(),cmp);//debug(“”)
cout<<v[0].id;
}