Two takes on the job of handing out holiday gifts to his friends. The houses his friends live in are numbered 1 to 9, and a house number is the name of the friend who lives there. Two lives in house 2.
The roads between the houses are often under repair, so not every pair of houses can be reached directly from one another. The usable roads are given in the input, and every road runs both ways.
Distance does not matter to Two. In one round trip he starts at house 2, moves only along roads, and comes back to house 2. He cannot pass the same house twice during a round trip, and he passes house 2 only when he leaves and when he arrives. Once he is back at house 2, that round trip ends there. Using the same road twice is fine, so walking to a neighboring house and coming straight back counts as one round trip. The walk 2-3-1-4-3-2 is not a round trip, because it passes house 3 twice.
Write a program that finds every possible round trip.
The first line has the number of usable roads N (1≤N≤36).
Each of the next N lines has the numbers of the two houses that road joins, a and b (1≤a,b≤9, a=b). The same road is never given twice.
Print one possible round trip per line.
Write each round trip as a single number, the house numbers along it joined in the order they are passed. The first digit and the last digit are always 2.
Read the round trips as numbers and print them from smallest to largest. If no round trip is possible, print nothing.