#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
typedef long long ll;


const int mod=1e9+7;
int c,T,n,k,ky[100010];
int f[100010]; 
int hdd[200010],tott;
int hd[200010],tot;


int main()
{
	freopen("traverse.in","r",stdin);
	freopen("traverse.out","w",stdout);
	scanf("%d%d",&c,&T);
	while(T--)
	{
		scanf("%d%d",&n,&k);
		for(int i=1;i<=n-1;i++)
		{
			int x,y;
			scanf("%d%d",&x,&y);
		}
		for(int i=1;i<=k;i++)
		{
			scanf("%d",&ky[i]);
		}
		if(c==18) 
		{
			cout<<1<<endl;
			continue;
		}
	}
	return 0;
}
