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