//
// Low-Link を用いた、橋・関節点列挙
//
// cf.
//   hos: グラフ探索アルゴリズムとその応用
//     http://hos.ac/slides/20110504_graph.pdf
//
// verified:
//   AOJ Course GRL_3_B Connected Components - Bridges
//     http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_3_B&lang=jp
//
//   Connected Components - Articulation Points
//     http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_3_A&lang=jp
//
//


/*
 
 
*/

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;


using Graph = vector<vector<int> >;
struct LowLink {
    // main results
    vector<int> aps; // articulation points
    vector<pair<int,int> > brs; // brideges
    
    // intermediate results
    vector<int> seen, ord, low;
    void dfs_lowlink(const Graph &G, int v, int p = -1) {
        static int time = 0;
        seen[v] = true;
        ord[v] = low[v] = time++;
        for (auto to : G[v]) {
            if (seen[to]) {
                if (to != p) low[v] = min(low[v], low[to]);
                continue;
            }
            dfs_lowlink(G, to, v);
            low[v] = min(low[v], low[to]);
            if (low[to] > ord[v]) brs.push_back(make_pair(v, to));
        }
    }
    void solve(const Graph &G) {
        int N = (int)G.size();
        seen.assign(N, 0); ord.resize(N); low.resize(N);
        aps.clear(); brs.clear();
        for (int v = 0; v < N; ++v) if (!seen[v]) dfs_lowlink(G, v);
    }
};


int main() {
    int V, E; cin >> V >> E;
    Graph G(V);
    for (int i = 0; i < E; ++i) {
        int s, t; cin >> s >> t;
        G[s].push_back(t);
        G[t].push_back(s);
    }
    LowLink ll;
    ll.solve(G);
    
    // 橋
    for (auto &br : ll.brs) if (br.first > br.second) swap(br.first, br.second);
    sort(ll.brs.begin(), ll.brs.end());
    for (auto br : ll.brs) cout << br.first << " " << br.second << endl;
}

### 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
//
// Low-Link を用いた、橋・関節点列挙
//
// cf.
//   hos: グラフ探索アルゴリズムとその応用
//     http://hos.ac/slides/20110504_graph.pdf
//
// verified:
//   AOJ Course GRL_3_B Connected Components - Bridges
//     http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_3_B&lang=jp
//
//   Connected Components - Articulation Points
//     http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_3_A&lang=jp
//
//


/*
 
 
*/

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;


using Graph = vector<vector<int> >;
struct LowLink {
    // main results
    vector<int> aps; // articulation points
    vector<pair<int,int> > brs; // brideges
    
    // intermediate results
    vector<int> seen, ord, low;
    void dfs_lowlink(const Graph &G, int v, int p = -1) {
        static int time = 0;
        seen[v] = true;
        ord[v] = low[v] = time++;
        for (auto to : G[v]) {
            if (seen[to]) {
                if (to != p) low[v] = min(low[v], low[to]);
                continue;
            }
            dfs_lowlink(G, to, v);
            low[v] = min(low[v], low[to]);
            if (low[to] > ord[v]) brs.push_back(make_pair(v, to));
        }
    }
    void solve(const Graph &G) {
        int N = (int)G.size();
        seen.assign(N, 0); ord.resize(N); low.resize(N);
        aps.clear(); brs.clear();
        for (int v = 0; v < N; ++v) if (!seen[v]) dfs_lowlink(G, v);
    }
};


int main() {
    int V, E; cin >> V >> E;
    Graph G(V);
    for (int i = 0; i < E; ++i) {
        int s, t; cin >> s >> t;
        G[s].push_back(t);
        G[t].push_back(s);
    }
    LowLink ll;
    ll.solve(G);
    
    // 橋
    for (auto &br : ll.brs) if (br.first > br.second) swap(br.first, br.second);
    sort(ll.brs.begin(), ll.brs.end());
    for (auto br : ll.brs) cout << br.first << " " << br.second << endl;
}

```