#include<bits/stdc++.h>
using namespace std;
long long mod=1e9+7;
const long long N=1e8+1;
int c[N],d[N];
int n,m,v;
int t;
int main(){
	freopen("assign.in","r",stdin);
	freopen("assign.out","w",stdin);
	cin>>t;
	while(t--){
		cin>>n>>m>>v;
		for(int i=1;i<=m;i++){
			cin>>c[i]>>d[i];
		}
		cout<<0<<endl; 
	} 
} 
