Emily is a teacher. She likes to give candies to her students on days near festivals. She would like to give the candies to the students in order.
She decides to distribute the candies to them one by one, with a rule that if student A is teased by B, A can receive candy before B. But this is a troublesome and time consuming task as she is very busy.
You are asked to help Emily by writing a program to find the order of students that satisfies the rule.
The first line of the input file contains an integer N (2 £ N £ 100), the number of students. The students are numbered as 1 to N. The following N lines describe each student being teased by whom. In the Kth line of those N lines, the first integer M (0 £ M < N) contains the number of students who tease student K, and the next M integers are the student numbers who tease student K.
The output file should contain the sequence of student numbers separated by a space that Emily can distribute the candies with the rule satisfied. If there is more than one solution, you are only required to output anyone of them. If there is no solution, output "No Solution".
Sample Input 1
2 2 3
Sample Output 1
1 4 2 3 5
Sample Input 2
2 2 3
Sample Output 2
do anyone know how to solve this problem?