A tree with `n` nodes (labeled `1` to `n`) had one extra edge added, creating exactly one cycle. You are given the resulting `edges` array.
Return the edge that can be removed so that the result is a tree of `n` nodes. If there are multiple answers, return the edge that occurs **last** in the input.
Example 1
Input:edges = [[1,2],[1,3],[2,3]]
Output:[2,3]
Explanation:Removing [2,3] leaves a tree.
Example 2
Input:edges = [[1,2],[2,3],[3,4],[1,4],[1,5]]
Output:[1,4]
Explanation:[1,4] closes the cycle 1-2-3-4-1.
Constraints
- n == edges.length
- 3 <= n <= 1000
- edges[i] = [a, b], 1 <= a < b <= n