#include <bits/stdc++.h>
using namespace std;
int T,n,m,v;
void solve(){
	scanf("%d%d%d",&n,&m,&v);
	for(int i = 1;i<=m;i++){
		int x,y;scanf("%d%d",&x,&y);
	}
	printf("%d\n",1);
}
int main(){
	freopen("assign.in","r",stdin);
	freopen("assign.out","w",stdout);
	scanf("%d",&T);
	while(T--){
		solve();
	}
	return 0;
}
