#include<bits/stdc++.h>
using namespace std;
int main(){
	freopen("query.in","r",stdin);
	freopen("query.out","w",stdout);
	int n,q;
	cin>>n;
	while(n--){
		int u,v;
		cin>>u>>v;
	}
	cin>>q;
	while(q--)cout<<1<<endl;
	fclose(stdin);
	fclose(stdout);
	return 0;
}
