A truss has n joints, numbered 1 through n, held by exactly n struts. Each strut connects two distinct joints, no two struts connect the same pair, and the whole truss is connected. Because there are n joints but n struts, the truss contains exactly one cycle.
Removing a single strut can turn the truss into a tree (connected with no cycle). Several struts might qualify; report the one that appears last in the input among all struts that qualify. Print that strut exactly as its two joint numbers appear on its input line.
Input format
- Line 1: an integer
n, the number of joints (also the number of struts). - Next
nlines: two integersuandv(1-indexed), a strut joining jointsuandv.
Output format
Two integers u v: the strut to remove, in the order it appeared in its input line.
Constraints
- 3 <= n <= 100000
- The truss is connected, simple, and has exactly one cycle.