#include<bits/stdc++.h>
using namespace std;
int main(){
	freopen("assign.in","r",stdin);
	freopen("assign.out","w",stdout);
	int T,n,m,v,a[100007],b[100040];
	cin>>T;
	while(T--){
		cin>>n>>m>>v;
		for(int i=1;i<=m;i++){
			scanf("%d%s",&a[i],&b[i]);
		}
		cout<<0<<endl;
	}
}
