# include<iostream>
# include<cstdio>
using namespace std;

int c,T,n,k,u,v,e;

void solve(){
	cin>>n>>k;
	for(int i=1;i<n;++i) cin>>u>>v;
	for(int i=1;i<=k;++i) cin>>e;
	cout<<1<<endl;
}

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--) solve();
	return 0;
}
