you give list airline ticket ticketsi fromi toi represent departure arrival airport flight Reconstruct itinerary order return itall ticket belong man depart JFK itinerary begin JFK if multiple valid itinerary return itinerary small lexical order read single stringfor example itinerary JFK LGA small lexical order JFK LGBYou assume ticket form valid itinerary you use ticket example 1input ticket MUCLHRJFKMUCSFOSJCLHRSFOOutput JFKMUCLHRSFOSJCExample 2input ticket JFKSFOJFKATLSFOATLATLJFKATLSFOOutput JFKATLJFKSFOATLSFOExplanation another possible reconstruction JFKSFOATLJFKATLSFO large lexical order Constraints1 ticketslength 300ticketsilength 2fromilength 3toilength 3fromi toi consist uppercase English lettersfromi toi