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

const int N = 1e5 + 10;

int n, m, v;
int c[N], d[N];
bool vis[N];

int main()
{
	freopen("assign.in", "r", stdin);
	freopen("assign.out", "w", stdout);
	
	int T;
	cin >> T;
	while (T--)
	{
		cin >> n >> m >> v;
		for (int i = 1; i <= m; i++)
		{
			cin >> c[i] >> d[i];
		}
		cout << 0 << endl;
	}
}

// ÏàÐÅÐþÑ§£¡ 

 
