Critical Infrastructure Links
A city's infrastructure consists of n hubs connected by m bidirectional communication links. A link is critical (or a bridge) if its removal would disconnect at least one hub from the rest of the network.
Your task is to identify all critical links and, for each one, determine which two regions would be separated.
Input
The first line contains two integers n and m (1 ≤ n ≤ 10^4, 0 ≤ m ≤ 10^4), the number of hubs and links.
Each of the next m lines contains two integers u and v (1 ≤ u, v ≤ n, u ≠ v), representing a bidirectional link between hubs u and v. There are no multiple edges or self-loops.
Output
For each critical link (in the order they appear in the input), print its two endpoints separated by a space, with the smaller endpoint first.
If there are no critical links, print nothing.
Notes
A critical link is an edge whose removal increases the number of connected components. A bridge is an edge that appears on every path between its two endpoints.
In the first example, the graph forms a simple path 1—2—3, so both edges are critical. Edge (1, 2) is a bridge, and edge (2, 3) is a bridge.