Two's Round Trips

No attempts yetTime limit1sMemory limit256 MB

Problem

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.

Input

The first line has the number of usable roads NN (1N361 \le N \le 36).

Each of the next NN lines has the numbers of the two houses that road joins, aa and bb (1a,b91 \le a, b \le 9, aba \ne b). The same road is never given twice.

Output

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.