#include<bits/stdc++.h>
using namespace std;
struct bian{
	int u,v;
}s[100005];
const int P=1e9+7;
int main(){
	freopen("traverse.in","r",stdin);
	freopen("traverse.out","w",stdout);
	int c,t;
	cin>>c>>t;
	while(t--){
		if(c==18){
			puts("1");
			continue;
		}
		//ÎÒ°®Æ­·Ö£¬Æ­·ÖºÃ°¡ 
		int n,k;
		cin>>n>>k;
		for(int i=1;i<n;i++){
			cin>>s[i].u>>s[i].v;
		}
		for(int i=1,x;i<=k;i++){
			cin>>x;
		}
	}
	return 0;
}
