John's Car
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 is made up of streets and intersections. Each street is uniquely numbered i (1 ≤ i ≤ 1994), and each intersection has a unique number j (1 ≤ j ≤ 44). The numbering of intersections is independent of the numbering of streets. Each street connects exactly two intersections, and some streets may connect an intersection to itself. There can also be multiple streets between the same pair of intersections. John lives at the intersection connected to the first street, which has the smallest number. He plans his route to visit all the streets in a sequence of street numbers that is lexicographically smallest. Additionally, John wants to return to his starting intersection.
Input
The input file contains multiple test cases. Each test case describes a city with several lines, each line representing a street with three numbers: x, y, and z (1 ≤ x, y ≤ 44, 1 ≤ z ≤ 1994). Here, x and y are the intersection numbers connected by the street, and z is the street number. Each test case concludes with a line containing two zeros.
A separate line with two zeros marks the end of the input file.
Output
For each test case, output two lines. The first line should list the sequence of street numbers in the order John visits them. The second line should be left empty. If no such tour exists for the described city, output the phrase "Round trip does not exist." without quotes.