#include <bits/stdc++.h>
#define ff(i,a,b) for(int (i) = (a); (i) < (b); ++ (i))
#define pii pair<int,int>
#define pll pair<long long,long long>
#define pic pair<int,char>
#define FF(i,a,b) for(int (i) = (a); (i) > (b); -- (i))
#define xx first
#define yy second
#define pb push_back
#define ll long long
#define pqq priority_queue
using namespace std;
struct zaza{
	int val;
	int idx;
};
zaza niga[200007];
bool cmp(zaza a, zaza b){
	if(a.val<b.val)return true;
	return false;
}
void solve(){
	int n;cin>>n;
	ff(i,1,n){
		int x,y;
		cin>>x>>y;
	}
	int maxi = INT_MIN;
	int id;
	ff(i,0,n){
		cin>>niga[i].val;
		int smena = niga[i].val;
		niga[i].idx = i+1;
		if(smena>maxi){
		   maxi = smena;
		   id = i+1;	
		}
	}
	int q;cin>>q;
	ff(i,0,q){
		int z,b;cin>>z>>b;
	}
	if(q == 0){
	cout<<id;
    }else{
    	sort(niga,niga+n,cmp);
    	for(int i = n-1;i>=n-1-q;i--){
    		cout<<niga[i].idx<<endl;
		}
	}
}
int main(){
	ios::sync_with_stdio(false);
    cin.tie(0);
    solve();
}