INPUT FILE: ticks.in
OUTPUT FILE: ticks.out
Mr. Juice, the clumsy physicist, is going on yet another trip. He wants you to put together an itinerary for him, mainly because he has managed to mix up his tickets with those of some other people. So, given n < 100 tickets (each consisting of an origin and a destination city) and the starting and ending points, print out the cities that will be visited, in the correct order. Each city's name will be less than 20 characters long.
INPUT
The list of starting and destination cities for each of the tickets will
be followed by a "*" on a line by itself, and then the cities from
and to which Mr. Juice wants to travel. The last set fo input will be followed
by a line with "-1".
OUTPUT
For each set of tickets in the input, print out the cities Mr. Juice will visit,
in the correct order. (If more than one path exists, someone made a mistake
in the input file. You may curse and print any one path.)
Sample Input File
There X Here There Somewhere Else * Here X -1
Output for Sample Input
Here->There->X