1. You are given number N and 2*N number of strings that represent a list of N tickets(source and destination). 2. You have to find the itinerary in order using the given list of tickets. Assumption -> The input list of tickets is not cyclic and there is one ticket from every city except the final destination.
Input Format
A number N N number of lines, where each line contains 2 strings.
Output Format
Check the sample ouput and question video.
Constraints
1 <= N <= 100
Example
Input
4 Chennai Banglore Bombay Delhi Goa Chennai Delhi Goa
Output
Bombay -> Delhi -> Goa -> Chennai -> Banglore.