#include<bits/stdc++.h>
using namespace std;
int c,T;
int n,k;
bool flag=1;
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;
	while(T--){
		cin>>n>>k;
		for(int i=1;i<n;i++){
			int x,y;	cin>>x>>y;
		}
		for(int i=1;i<=k;i++){
			int a;	cin>>a;
		}
		if(c==18){
			cout<<1<<"\n";
		}
	}
	return 0;
}
