#include <iostream>
#include <set>
#include <stack>
#include <queue>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
int x;
int y;
int main ()
{
cin>>x;
int ball[x];
for (int i=0;i<x;i++)
{
cin>>ball[i];
}
cin>>y;
int loca[y];
for (int i=0;i<y;i++)
{
cin>>loca[i];
}
int is[y];
for (int i=0;i<y;i++)
{
for (int j=0;j<x;j++)
{
if(loca[i]==ball[j])
{
is[i]=j+1;
break;
}
else
{
is[i]=0;
}
}
}
for (int i=0;i<y;i++)
{
cout<<is[i]<<endl;
}
return 0;
}