#include<bits/stdc++.h>
using namespace std;
#define N 100005
long long c,T,n,k,a,b,e,mo=1e9+7;
int 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",&a,&b);
		}
		for(int i=1;i<=k;i++) scanf("%lld",&e);
		printf("1\n");
	}
	return 0;
}
