Given a tree with vertices numbered from 1 to
, we say a sequence
is a "spanning sequence" of the tree if it passes the following validation:
We now present you with a connected graph with vertices and
edges. Please find a spanning tree of this graph such that the minimum spanning sequence of the tree is as large as possible. In this problem, we compare the sequences by lexicographic order.
In case you're not familiar with some concepts referred above:
There are multiple test cases. The first line of the input contains an integer
indicating the number of test cases. For each test case:
The first line of the input contains two integers
and
(
,
), indicating the number of vertices and edges of the graph.
For the following
lines, the
-th line contains two integers
and
(
), indicating that there is an edge connecting vertex
and
.
It's guaranteed that:
- There are no self loops or multiple edges.- The given graph is connected.- Neither the sum ofnor the sum of
will exceed
.
For each test case output one line containingintegers separated by a space, indicating the minimum spanning sequence of the desired spanning tree.