#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=1e5,K=1e5,MOD=1e9+7;
int c,T,n,k;
int u[N+10],v[N+10],e[K+10];
signed main(){
	freopen("traverse.in","r",stdin);
	freopen("traverse.out","w",stdout);
	scanf("%lld%lld",&c,&T);
	while(T--){
		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",&e[i]);
		printf("1\n");
	}
	return 0;
}

