1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <bits/stdc++.h>
#define ff first
#define ss second

using namespace std;

typedef long long lld;

constexpr int INF = (1<<30) - 1;
constexpr lld LINF = (1LL << 62) - 1;
constexpr int MAX_N = 1000000;

int n,m,k;
int t[MAX_N+9];
vector<int> res;

void solve(int test_number)
{
	scanf("%d%d%d", &n, &m, &k);
	for (int i = 1; i <= n; ++i)
	{
		t[i] = m;
	}
	for (int i = 0; i < m; ++i)
	{
		int a,b;
		scanf("%d%d", &a, &b);
		t[a]--;
		t[b]--;
	}
	int min_spells = 1;
	for (int day = 1; day <= k; ++day)
	{
		res.clear();
		for (int i = 1; i <= n; ++i)
		{
			if (t[i] < min_spells)
			{
				res.push_back(i);
			}
		}
		if (res.size())
		{
			printf("%d %d\n", day, res.size());
			for(auto wizard : res)
			{
				printf("%d ", wizard);
			}
			printf("\n");
			return;
		}
		min_spells = (min_spells * n + n-3) / (n-2);
	}
	printf("-1\n");
}

int main()
{
	int test_number = 1;
	scanf("%d", &test_number);
	for (int test_id = 0; test_id < test_number; ++test_id)
	{
		solve(test_number);
	}
}