John’s Tasks

 

Program TASKS.C, TASKS.CPP, TASKS.PAS

John’s boss likes to give his employees a lot of tasks at once, to save himself the trouble of leaving his office too many times. Unfortunately, the tasks he gives are not independent so the execution of one task is only possible if some other tasks have already been executed. Of course the boss won’t bother to sort the tasks... therefore John must do it on his own. To make things even more complicated, it’s sometimes impossible to sort the tasks (because one task depends on another which again depends on the first).

Input

The input will consist of several instances of the problem. Each instance begins with a line containing two integers, 1 <= n <= 100 and m. n is the number of tasks (numbered from 1 to n) and m is the number of direct precedence relations between tasks. After this, there will be m lines with two integers i and j, representing the fact that task i must be executed before task j. An instance with n = m = 0 will finish the input.

Output

For each instance, print a line with n integers representing the tasks in a possible order of execution. If there’s more than one solution, print lexicographicaly smallest one. If it’s impossible to find a good ordering, print “No solution.

Sample Input
5 4
1 2
2 3
1 3
1 5
3 3
1 2
2 3
3 1
0 0

Sample Output
1 2 3 4 5
No solution.