#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1e9+7;
ll a[100005];
int q[100005],c,t,n,k;
vector<int>e[100005];
int main(){
	freopen("traverse.in","r",stdin);
	freopen("traverse.out","w",stdout);
	cin>>c>>t;
	while(t--){
		cin>>n>>k;
		for(int i=1;i<n;i++){
			int u,v;
			scanf("%d%d",&u,&v);
		}
		for(int i=1;i<=k;i++){
			scanf("%d",&q[i]);
		}
		cout<<1<<endl;
	}
	return 0;
}
