#include "bits/stdc++.h"
#define REP(i, n) for(int i = 0; i < int(n); i++)
#define FOR(i,n,m) for(int i = int(n); i < int(m); i++)
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 6;
const ll LLINF = 1e18 + 1;

// 橋・関節点列挙 O(V)
struct LowLink {
private:
    vector< vector< int > > G;
    int V; // 頂点数
    vector< int > used, ord, low;

    int dfs(int idx, int k, int par) {
        used[idx] = true;
        ord[idx] = k++;
        low[idx] = ord[idx];
        bool is_articulation = false;
        int cnt = 0;
        for (auto &to : G[idx]) {
            if (!used[to]) {
                ++cnt;
                k = dfs(to, k, idx);
                low[idx] = min(low[idx], low[to]);
                is_articulation |= ~par && low[to] >= ord[idx];
                if (ord[idx] < low[to]) bridge.push_back(minmax(idx, (int)to));
            }
            else if (to != par) {
                low[idx] = min(low[idx], ord[to]);
            }
        }
        is_articulation |= par == -1 && cnt > 1;
        if (is_articulation) articulation.push_back(idx);
        return k;
    }

public:
    vector< int > articulation; // 関節点
    vector< pair< int, int > > bridge; // 橋

    LowLink(int V) : V(V) {
        G.resize(V);
    }

    // 無向辺を張る
    void add_edge(int v, int u) {
        G[v].push_back(u);
        G[u].push_back(v);
    }

    void build() {
        used.assign(V, 0);
        ord.assign(V, 0);
        low.assign(V, 0);
        int k = 0;
        for (int i = 0; i < V; i++) {
            if (!used[i]) k = dfs(i, k, -1);
        }
    }
};

int main() {
    int v, e; cin >> v >> e;
    LowLink G(v);
    REP(i, e) {
        int a, b; cin >> a >> b;
        G.add_edge(a, b);
    }
    G.build();
    sort(G.bridge.begin(), G.bridge.end());
    for (auto &e : G.bridge) {
        cout << e.first << " " << e.second << endl;
    }
    return 0;
}

### Prompt

Construct a CPP code solution to the problem outlined:

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"
#define REP(i, n) for(int i = 0; i < int(n); i++)
#define FOR(i,n,m) for(int i = int(n); i < int(m); i++)
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
const int INF = 1e9 + 6;
const ll LLINF = 1e18 + 1;

// 橋・関節点列挙 O(V)
struct LowLink {
private:
    vector< vector< int > > G;
    int V; // 頂点数
    vector< int > used, ord, low;

    int dfs(int idx, int k, int par) {
        used[idx] = true;
        ord[idx] = k++;
        low[idx] = ord[idx];
        bool is_articulation = false;
        int cnt = 0;
        for (auto &to : G[idx]) {
            if (!used[to]) {
                ++cnt;
                k = dfs(to, k, idx);
                low[idx] = min(low[idx], low[to]);
                is_articulation |= ~par && low[to] >= ord[idx];
                if (ord[idx] < low[to]) bridge.push_back(minmax(idx, (int)to));
            }
            else if (to != par) {
                low[idx] = min(low[idx], ord[to]);
            }
        }
        is_articulation |= par == -1 && cnt > 1;
        if (is_articulation) articulation.push_back(idx);
        return k;
    }

public:
    vector< int > articulation; // 関節点
    vector< pair< int, int > > bridge; // 橋

    LowLink(int V) : V(V) {
        G.resize(V);
    }

    // 無向辺を張る
    void add_edge(int v, int u) {
        G[v].push_back(u);
        G[u].push_back(v);
    }

    void build() {
        used.assign(V, 0);
        ord.assign(V, 0);
        low.assign(V, 0);
        int k = 0;
        for (int i = 0; i < V; i++) {
            if (!used[i]) k = dfs(i, k, -1);
        }
    }
};

int main() {
    int v, e; cin >> v >> e;
    LowLink G(v);
    REP(i, e) {
        int a, b; cin >> a >> b;
        G.add_edge(a, b);
    }
    G.build();
    sort(G.bridge.begin(), G.bridge.end());
    for (auto &e : G.bridge) {
        cout << e.first << " " << e.second << endl;
    }
    return 0;
}

```