Ms. Lorsong had been working with some members of the student band all day trying to get everyone positioned just right. Finally, she had everyone lined up just the way she wanted; but she knew she couldn't just remember their positions. So, she gave each student a sheet of paper and asked each of them to write down his/her name and the name of the student to the immediate left. Naturally, the student on the left end of the line couldn't do this; so s/he did nothing.
Ms. Lorsong thought that if she carefully collected the papers she would be able to reconstruct the line order (and she was right). However, she wasn't very careful and collected all the sheets in a basket (where they became thoroughly scrambled). She then had the information from the sheets transferred to a file. Each record in the file consists of two names, each up to 8 characters long, padded with blanks if necessary. For example, a record may contain these characters, "Dave Cathy " The first name is the person who wrote the sheet; the second is the name of the student to that person's left. Fortunately, all the student names are unique.
Your job is to read the file and display the reconstructed band lineup by listing the names of the students in order from right to left. You may a ssume that there are no more than 100 students in the band. Following is a sample input and output for your program.
Input:
Bob Prisilla Dave Cathy PrisillaDave Ann Bob
Output:
Ann Bob Prisilla Dave Cathy