#include<bits/stdc++.h>
using namespace std;
int c,t,n,k,u,v,e;
int main()
{
	freopen("traverse.in","r",stdin);
	freopen("traverse.out","w",stdout);
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	cin>>c>>t;
	for(int i=1;i<=t;i++)
	{
		cin>>n>>k;
		for(int j=1;j<n;j++)
		{
			cin>>u>>v;
		}
		for(int j=1;j<=k;j++)
		{
			cin>>e;
		}
		cout<<2;
	}
	return 0;
}
