#include<bits/stdc++.h>
using namespace std;
namespace IO{
	void read(int &x){
		short f=1;x=0;char ch=getchar();
		while(ch<'0'||ch>'9'){if(ch=='-') f=-1;ch=getchar();}
		while(ch>='0'&&ch<='9') x=(x<<3)+(x<<1)+(ch^48),ch=getchar();
		x*=f;
		return;
	}
	void out(int x){
		if(x<0) putchar('-'),x=-x;
		if(x>9) out(x/10);
		putchar(x%10+'0');
		return;
	}
	void endl(){
		putchar('\n');
		return;
	}
}
using IO::read;
using IO::out;
using IO::endl;
const int N=1000005;
int c,T,n,k;
int e[N],ls[N],nx[N],em;
void insert(int x,int y){
	e[++em]=y,nx[em]=ls[x],ls[x]=em;
	return;
} 
signed main(){
	freopen("traverse.in","r",stdin);
	freopen("traverse.out","w",stdout);
	read(c),read(T);
	while(T--){
		read(n),read(k);
		for(int i=1;i<n;i++){
			int x,y;
			read(x),read(y);
			insert(x,y),insert(y,x);
		}
		if(c==18) putchar('1'),endl();
	}
	return 0;
}
