Ordering tasks
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 128 megabytes
John has tasks to do. Unfortunately, the tasks are not independent and the execution of one task is only possible if other tasks have already been executed.
Input
Consist of several instances of the problem. Each instance begins with a line containing two integers: number of tasks , numbered from to and number of direct precedence relations between tasks. After this, there will be lines with two integers and , representing the fact that task must be executed before task .
An instance with will finish the input.
Output
For each instance, print a line with integers representing the tasks in a possible order of execution.
Examples
Input #1
Answer #1
Submissions 579
Acceptance rate 50%