408665: GYM103260 E Smol Vertex Cover

Memory Limit:0 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

E. Smol Vertex Covertime limit per test2 secondsmemory limit per test256 mebibytesinputstandard inputoutputstandard output

Given an undirected graph, find a minimum vertex cover. Crazy, right?

Let $$$M$$$ be the size of maximum matching, and $$$C$$$ be the size of minimum vertex cover. If minimum vertex cover is smol, which means $$$C \le M + 1$$$, then find it.

Input

Each test contains multiple test cases. The first line contains the number of test cases $$$T$$$ ($$$1 \le T \le 10^4$$$). Description of the test cases follows.

The first line of each test case contains two integers $$$n$$$ and $$$m$$$ ($$$1 \le n \le 500$$$, $$$0 \le m \le \frac{n(n-1)}{2}$$$) — the number of vertices and edges in the graph.

Next $$$m$$$ lines describe edges of the graph, each of them contains two integers $$$u$$$ and $$$v$$$ ($$$1 \le u < v \le n$$$) — vertices connected by an edge. Vertices are numbered from $$$1$$$ to $$$n$$$.

It is guaranteed that the graph doesn't contain multiple edges.

It is guaranteed that the sum of $$$n^2$$$ over all test cases does not exceed $$$250\,000$$$.

Output

For each test case, if minimum vertex cover is smol, then print its size $$$C$$$ on the first line, and then $$$C$$$ different space-separated vertices that form a vertex cover on the second line. Otherwise print "not smol" on a single line (without quotes).

If there are several possible smol minimum vertex covers, print any one of them.

ExamplesInput
1
5 5
1 2
2 3
3 4
4 5
1 5
Output
3
2 3 5 
Input
2
3 0
5 10
1 2
1 3
1 4
1 5
2 3
2 4
2 5
3 4
3 5
4 5
Output
0

not smol
Note

Vertex cover is a set of vertices such that for each edge at least one of the endpoints belongs to the set.

Matching is a set of edges such that no two edges from it have common endpoint.

Note that a minimum vertex cover would not be accepted as a correct answer if it is not smol.

加入题单

算法标签: