Strange Tournament
**N** participants engaged in a round-robin table tennis tournament, where each participant played against every other participant exactly once. There were no ties in this tournament.
The tournament is termed **K**-strange if there exists a "strange" sequence of **K** distinct participants, denoted as **A_1, A_2, ..., A_K**, such that **A_1** defeated **A_2**, **A_2** defeated **A_3**, continuing in this manner until **A_K-1** defeated **A_K**, and finally, **A_K** defeated **A_1**. Your task is to write a program that, for each **K** from **3** to **N**, determines whether the tournament is **K**-strange. If it is, the program should construct a "strange" sequence of the specified length.
Input
The input begins with the number **N** (**3** ≤ **N** ≤ **300**). Following this, the results of the matches are provided. Each match result is given as two numbers: the first number represents the player who won, and the second number represents the player who lost. Each match result appears exactly once in the input.
Output
The output should consist of exactly **N-2** lines. The **i**-th line should provide the solution for **K=i+2**. For each **K**, the output should list **K** numbers, representing the sequence of participants **A_1, A_2, ..., A_K** in the "strange" chain, separated by spaces. If the tournament is not **K**-strange, then all these numbers should be **0**.