#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	int n,u,v,q;
	freopen("query.in","r",stdin);
	freopen("query.out","w",stdout);
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	scanf("%d%d",&u,&v);
	scanf("%d",&q);
	for(int i=1;i<=q;i++)
	printf("1\n");
	return 0;
}
