← 返回 amazon 的题目列表Reconstruct Trip Route from Ticket Tuples
类型:online_judge
amazon
Given a list of tuples where (A, B) symbolizes a ticket from A to B. Construct the full trip. The answer is always a one direction trip without divergence.
Example:
Input: [(C,D), (A,B), (B,C)]
Output: [A, B, C, D]
Example
Input
3
C D
A B
B C