#include<bits/stdc++.h>
using namespace std;
int t,n,m,val;
int a[100001],b[100001];
int main(){
	freopen("assign.in","r",stdin);
	freopen("assign.out","w",stdout);
	cin>>t;
	while(t--){
		cin>>n>>m>>val;
		for(int i=1;i<=m;i++)cin>>a[i]>>b[i];
		cout<<0<<"\n";
	}
	fclose(stdin);
	fclose(stdout);
	return 0;
}

