#include<bits/stdc++.h>
using namespace std;
const int N=1e5+5; 
int c,T;
int n,k;
vector<int> e[N];
int main(){
	freopen("traverse.in","r",stdin);
	freopen("traverse.out","w",stdout);
	cin>>c>>T;
	while(T--)
	{
		scanf("%d%d",&n,&k);
		for(int i=1;i<n;i++)
		{
			int u,v;
			scanf("%d%d",&u,&v);
			e[u].push_back(v);
		}
		for(int i=1;i<=k;i++)
		{
			int x;
			scanf("%d",&x);
		}
		printf("1\n");
	}
	return 0;
}
