Request Trace Reconstruction

A distributed trace records every request as a directed ticket [from, to] between services. Service JFK is the entry point. The trace is valid exactly when its tickets can be chained into one walk that uses every ticket once. Reconstruct the walk.

Return the service sequence that starts at JFK, uses every ticket exactly once, and is lexicographically smallest among all valid reconstructions. Each airport code is three uppercase letters except JFK is fixed as start. If no other choice exists the tickets are guaranteed to admit at least one Eulerian walk starting at JFK.

Lexicographic order compares itineraries from the first service onward. At any branching service you must visit the smallest possible next service that still allows a complete walk. Sorting adjacency lexicographically and consuming edges in postorder achieves this.

Examples
Input: [["JFK","SFO"],["SFO","JFK"],["JFK","ATL"]]
Output: ["JFK","SFO","JFK","ATL"]
Hints

Request Trace Reconstruction

A distributed trace records every request as a directed ticket `[from, to]` between services. Service `JFK` is the entry point. The trace is valid exactly when its tickets can be chained into one walk that uses every ticket once. Reconstruct the walk.