#include<bits/stdc++.h>
using namespace std;

int main()
{
	freopen("assign.in","r",stdin);
	freopen("assign.out","w",stdout);
	int T;
	cin>>T;
	for(int i=1;i<=T;i++)
	{
		int n,m,v;
		cin>>n>>m>>v;
		for(int j=1;j<=m;j++)
		{
			int x,y;
			cin>>x>>y; 
		}
		cout<<0;
		puts("");
	}

	return 0;
}

