Torn to Pieces
InterviewTime limit2sMemory limit256 MB
Rebuild the subway graph from the torn map pieces and print the stations on the path from the start to the destination, or no route found.
Problem
You have reached the big city, but your trip is not over. You still have to ride the subway to your final destination. The information booth in the station is empty and the maps are all gone. On the floor you see torn pieces of a subway map. Can you put enough of them together to work out how to reach your destination?
Each piece holds exactly one station and lists the names of every station directly connected to it. A connection between two stations is bidirectional, so you may travel it in either direction. Using all of the pieces you found, work out the order of the stations you pass through on the way from the starting station to the destination. If the pieces are not enough to determine a route, report that no route exists.

Input
The first line contains the number of map pieces that were found. ()
Each of the next lines describes one station drawn on a piece. The line starts with the name of that station, followed by the space separated names of the stations directly connected to it. There are at most connected stations.
The last line contains the name of the starting station and the name of the destination station. The destination station is different from the starting station.
A station name is a string of at most 20 letters a to z and A to Z, and letter case matters. There is at most one route from the starting station to the destination that visits no station twice.
Output
Print the names of the stations along the way from the starting station to the destination, in order, separated by single spaces on one line. The starting station and the destination station are included. If the pieces are not enough to find a route, print no route found.