Building a car takes a whole list of jobs, and some of them depend on others - the axles have to go on before the wheels do. Your task is to find an order in which all jobs can be carried out without ever starting a job before something it depends on.
Jobs are numbered to . Several orders are usually possible, so print the lexicographically smallest one: of all valid orders, the one whose first number is smallest, and among those the one whose second number is smallest, and so on.
Input
First line of input will be a single integer - the number of testcases.
The first line of each testcase contains two integers and - the number of jobs and the number of dependencies.
Each of the next lines contains two integers and , meaning that job has to be done before job . Note the order: the job that comes second on the line is the one that has to happen first.
An order is guaranteed to exist.
Output
For every testcase print a single line with all job numbers in the lexicographically smallest valid order, separated by one space.
Example
1 6 6 3 1 3 2 4 2 4 5 1 0 0 5
2 5 0 1 3 4
Only jobs and have nothing before them, and is the smaller one, so it goes first. That releases nothing new, so follows, which frees both and - and is smaller. Job has to wait until and are both done, and job until and are.
Constraints
and
The sum of over all testcases does not exceed , and the sum of does not exceed
This problem was adapted, with permission, from Redosled poslova, authored by Društvo matematičara Srbije and Fondacija Petlja.