Scheduling classes ------------------ The programming contest coaches have (after a couple of fistfights) agreed on what courses would prepare a contestant to excel in programming contests. Each course has one or more prerequisites. For simplicity assume that the prerequisites do not involve any courses outside the list being discussed. Unfortunately, the list is large and the prerequisite structure complex. So the coaches would like to figure out if it is indeed possible to take all those courses, and if it is then a sequence in which the courses can be taken. For example, consider the courses Algorithms, Contest Prep 1 and Contest Prep 2. The coaches meant to make Contest Prep 1 a prerequisite of Algorithms and Contest Prep 2 and Algorithms a prerequisite of Contest Prep 2 but they mistakenly made Contest Prep 1 a prerequisite of Algorithms and Algorithms a prerequisite of Contest Prep 2 and Contest Prep 2 a prequisite of Contest Prep 1. Now no student can complete those courses! In this problem you are given a set of courses numbered 1 to n (n < 1000) and a set of prerequisites of the form i,j, where i,j are course numbers. You should output a valid sequence of courses or "No sequence exists", if none exists. Input ----- The input contains several problem instances. Each instance starts with a line containing two integers n and m, where 0 < n < 1000. These numbers represent the number of courses and the number of prerequisites in the problem. After this, m lines follow, each containing two course numbers specifying a prerequisite. An input with n = m = 0 marks the end of the input and is not to be processed. Output ------ Decide whether the courses can be taken, and print the result as shown below. Sample Input ------------ 3 3 1 2 2 3 3 1 9 8 1 2 1 3 1 4 1 5 1 6 1 7 1 8 1 9 0 0 Sample Output ------------- No sequence exists 1 2 3 4 5 6 7 8 9