#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)

int n, m;
vector<vector<int>> g;
vector<bool> visited;
vector<int> ord;
vector<int> low;
vector<int> parent;
int timer = 0;
vector<pair<int,int>> bridge;

void dfs(int cur, int prev) {
    ord[cur] = low[cur] = timer++;
    visited[cur] = true;
    for (int next : g[cur]) {
        if (visited[next] == false) {
            parent[next] = cur;
            dfs(next, cur);
            low[cur] = min(low[cur], low[next]);
            if (ord[cur] < low[next]) {
                if (cur < next) bridge.push_back({cur,next});
                else bridge.push_back({next,cur});
            }
        } else if (next != prev) {
            low[cur] = min(low[cur], ord[next]);
        }
    }
}

void art_points() {
    set<int> ap;
    timer = 1;
    dfs(0, 1);
    int child = 0;
    rep(i, n) {
        if (i == 0) continue;
        if (parent[i] == 0) child++;
        else if (ord[parent[i]] <= low[i]) ap.insert(parent[i]);
    }
    if (child > 1) ap.insert(0);
}

int main() {
    cin >> n;
    cin >> m;
    g.resize(n);
    visited.resize(n, false);
    ord.resize(n);
    low.resize(n);
    parent.resize(n);
    rep(i, m) {
        int s, t ;
        cin >> s;
        cin >> t;
        g[s].push_back(t);
        g[t].push_back(s);
    }
    dfs(0,1);
    sort(bridge.begin(), bridge.end());
    rep(i, bridge.size()) {
        printf("%d %d\n", bridge[i].first, bridge[i].second);
    }
}

### Prompt

Please provide a CPP coded solution to the problem described below:

Find bridges of an undirected graph G(V, E).

A bridge (also known as a cut-edge) is an edge whose deletion increase the number of connected components.

Constraints

* 1 ≤ |V| ≤ 100,000
* 0 ≤ |E| ≤ 100,000
* The graph is connected
* There are no parallel edges
* There are no self-loops

Input


|V| |E|
s0 t0
s1 t1
:
s|E|-1 t|E|-1


, where |V| is the number of nodes and |E| is the number of edges in the graph. The graph nodes are named with the numbers 0, 1,..., |V|-1 respectively.

si and ti represent source and target nodes of i-th edge (undirected).

Output

A list of bridges of the graph ordered by name. For each bridge, names of its end-ponints, source and target (source < target), should be printed separated by a space. The sources should be printed ascending order, then the target should also be printed ascending order for the same source.

Examples

Input

4 4
0 1
0 2
1 2
2 3


Output

2 3


Input

5 4
0 1
1 2
2 3
3 4


Output

0 1
1 2
2 3
3 4

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)

int n, m;
vector<vector<int>> g;
vector<bool> visited;
vector<int> ord;
vector<int> low;
vector<int> parent;
int timer = 0;
vector<pair<int,int>> bridge;

void dfs(int cur, int prev) {
    ord[cur] = low[cur] = timer++;
    visited[cur] = true;
    for (int next : g[cur]) {
        if (visited[next] == false) {
            parent[next] = cur;
            dfs(next, cur);
            low[cur] = min(low[cur], low[next]);
            if (ord[cur] < low[next]) {
                if (cur < next) bridge.push_back({cur,next});
                else bridge.push_back({next,cur});
            }
        } else if (next != prev) {
            low[cur] = min(low[cur], ord[next]);
        }
    }
}

void art_points() {
    set<int> ap;
    timer = 1;
    dfs(0, 1);
    int child = 0;
    rep(i, n) {
        if (i == 0) continue;
        if (parent[i] == 0) child++;
        else if (ord[parent[i]] <= low[i]) ap.insert(parent[i]);
    }
    if (child > 1) ap.insert(0);
}

int main() {
    cin >> n;
    cin >> m;
    g.resize(n);
    visited.resize(n, false);
    ord.resize(n);
    low.resize(n);
    parent.resize(n);
    rep(i, m) {
        int s, t ;
        cin >> s;
        cin >> t;
        g[s].push_back(t);
        g[t].push_back(s);
    }
    dfs(0,1);
    sort(bridge.begin(), bridge.end());
    rep(i, bridge.size()) {
        printf("%d %d\n", bridge[i].first, bridge[i].second);
    }
}

```