#include<bits/stdc++.h>
using namespace std;
int n,k,c,T,u[100001],v[100001],e[100001];
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++){
			cin>>u[i]>>v[i];
		}
		for(int i=1;i<=k;i++){
			cin>>e[i];
		}
		cout<<n/2;
	}
}
