Write a program to print all the leaves of the given tree, numbered from 1 to N. The root of the tree is node 1.

Submit: 687 Solved: 239

[Submit][Status][Web Board]

Write a program to print all the leaves of the given tree, numbered from 1 to N. The root of the tree is node 1.

The first line will be an integer T (1≤T≤10), which is the number of test cases.

For each test data:

The first line contains an integer N (2≤N≤10^4) — the number of the nodes.

Each of the next N - 1 lines contain two integers a and b, which means there is an edge between node a and b (1≤a, b≤N).

For each case please, print all the leaves of the given tree, in ascending order.

For the tree has multiple leaf nodes, there is a blank between two leaf nodes, and ‘\n’ at the end of each line.

```
1
4
1 2
2 3
3 4
```

```
4
```