#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1e5 + 5,mod = 1e9 + 7;

int n,k;
vector<int> e[N];
struct EDGE{
	int u,v;
}edge[N];int num[N];
namespace substacka{
	void solvea(){
		cin >> n >> k;for (int i = 1,u,v;i < n;i++){
			cin >> u >> v;
			e[u].push_back(v);e[v].push_back(u);
			edge[i] = {u,v};
		}for (int i = 1;i <= k;i++) cin >> num[i]; 
		cout << 1 << "\n";
	}
}using namespace substacka;
namespace substackb{
	int qpow(int x,int y){
		int res = 1;while (y){
			if (y & 1) res = res * x % mod;
			x = x * x % mod;
			y /= 2;
		}return res;
	}
	void solveb(){
		cin >> n >> k;
		for (int i = 1,u,v;i < n;i++){
			cin >> u >> v;
			e[u].push_back(v);e[v].push_back(u);
			edge[i] = {u,v};
		}for (int i = 1;i <= k;i++) cin >> num[i];
		
	}
}using namespace substackb;
signed main(){
	freopen("traverse.in","r",stdin);
	freopen("traverse.out","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	int c,T;cin >> c >> T;
	if (c == 18){
		while (T--) solvea();
		return 0;
	}
	if (19 <= c && c <= 21){
		while (T--) solveb();
		return 0;
	}
	return 0;
}

