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