John's Car#2275

John's Car

1 second
64 megabytes
Very hard

John recently bought a new car and wants to show it off to all his friends by driving through every street in his city. To conserve gasoline, he plans to drive down each street exactly once. The city consists of streets and intersections. Each street is uniquely numbered (1 \leq i \leq 1994), and each intersection has a unique number (1 \leq j \leq 44). The numbering of intersections is independent of the numbering of streets. Each street connects exactly two intersections (a street may connect an intersection to itself). There can be multiple streets between the same pair of intersections. John lives at the intersection at the end of the first street, which has the smallest number. When planning the route as a sequence of street numbers, John selects the route corresponding to the lexicographically smallest sequence. Additionally, John wants to return to his starting intersection.

Input

The input file contains multiple test cases. Each test case describes a city. Each test case is given in several lines, each line describing one street with three numbers: , , and (1 \leq x, y \leq 44, 1 \leq z \leq 1994), where and are the intersection numbers connected by the street, and is the street number. Each test case ends with a line containing two zeros.

A separate line with two zeros marks the end of the input file.

Output

For each test case, print two lines with the answer. The first line contains the sequence of street numbers in the order John visits them. The second line must be empty. If there is no required route for the described city, print the phrase Round trip does not exist. without quotes.

Examples

Example 1

Loading
Loading