There are students and snacks. The students and the snacks are each numbered .
Each student likes one or more of the snacks. More precisely, student () likes snacks, numbered .
Initially the room contains exactly one of each of the kinds of snack. The snacks will be distributed as follows.
Determine whether there is an order in which every student takes exactly one snack. If so, find any such order.
The first line contains the integer , the number of students and of snacks.
The next lines describe the snacks the students like. Line of these () contains the integer followed by the integers , in that order and separated by spaces.
If there is no order in which every student takes exactly one snack, print -1 on the first line.
Otherwise, print an order in which every student takes exactly one snack. Print the student numbers on the first line, separated by spaces.
If more than one output is valid, any one is accepted.
The students like the following snacks.
If students , , and enter in that order, each takes exactly one snack.
The order likewise gives every student exactly one snack.
Both students like every kind of snack, so whoever enters first takes all the snacks, regardless of the order.