#include <iostream>
using namespace std;
#define int long long
const int mod = 1e9 + 7, N = 300010;
int fact[N], infact[N];
int qmi(long long a, long long k){
	int res = 1;
	while (k){
		if(k & 1) res = (long long)res * a % mod;
		a = (long long)a * a % mod;
		k >>= 1;
	}
	return res;
}
signed main(){
	freopen("traverse.in", "r", stdin);
	freopen("traverse.out", "w", stdout);
	int C, T;
	cin >> C >> T;
	while (T -- ){
		int n, k;
		cin >> n >> k;
		if(C == 18){
			int a, b;
			for (int i = 1; i < n; i ++ ) scanf("%lld%lld", &a, &b);
			for (int i = 1; i <= k; i ++ ) scanf("%lld", &a);
			puts("1");
		}
	}
}
