#include<bits/stdc++.h>
using namespace std;
#define int long long
int C,testcase;
const int N=2e5+10,mod=1e9+7;
int n,k;
int head[N],tot;
int U[N],V[N],kkk[N];
struct edge{
	int to,nxt;
}e[N*2];
void add(int u,int v){
	e[++tot]={v,head[u]};
	head[u]=tot;
}
void solveA(){
	
}
void solveB(){
	
}
void solve(){
	scanf("%lld%lld",&n,&k);
	for(int i=1;i<n;i++){
		scanf("%lld%lld",&U[i],&V[i]);
	}
	for(int i=1;i<=k;i++){
		scanf("%lld",&kkk[i]);
	}
	if(C<=10){
		solveA();
	}
	else if(C==18){
		printf("%d\n",1);
		return; 
	}
	else{
		solveB();
	}
}
signed main(){
	freopen("traverse.in","r",stdin);
	freopen("traverse.out","w",stdout);
	scanf("%d%d",&C,&testcase);
	while(testcase--){
		solve();
	}
	return 0;
} 
