#SDNU1257. Problem E. SDNU ACM/ICPC TEAM
Problem E. SDNU ACM/ICPC TEAM
Description
Lulichuan is the captain of SDNU ACM/ICPC TEAM, he have many team members, Their ability has a sequence from to , now , lulichuan want to labeled them from to in this way
Two member have different label
The labeling satisfies several constrains like "The member labeled with is lower than the one labeled with ”.
Format
Input
The first line is , is TestCase
The first line of each testcase is two number
The next line each contain two integers and indicating the member labeled with must be lower than the one labeled with .
Output
For each test case output on a single line the member' ability from label to label . If several solutions exist, you should output the one with the lowest ability for label , then with the lowest ability for label and so on... If no solution exists, output instead.
Samples
5
4 0
4 1
1 1
4 2
1 2
2 1
4 1
2 1
4 1
3 2
1 2 3 4
-1
-1
2 1 3 4
1 3 2 4