#include <bits/stdc++.h>
using namespace std;

#define DUMP(x) cerr << #x << "=" << x << endl
#define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")"<< endl
#define BINARY(x) static_cast<bitset<16> >(x)

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)

#define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;
const int INF = 1e9;
typedef pair<int, int> PII;
int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1};


const int MAX_V = 1e5;
vector<int> G[MAX_V];

set<int> used_v;
set<PII> used_e;
int ord[MAX_V], lowlink[MAX_V];
int k = 0;

void calc_lowlink(int v)
{
    used_v.insert(v);
    ord[v] = lowlink[v] = k++;

    for (auto u : G[v]) {
        if (!used_v.count(u)) {
            used_e.insert(PII(v, u));
            calc_lowlink(u);
            lowlink[v] = min(lowlink[v], lowlink[u]);
        } else if (!used_e.count(PII(u, v))) {
            // backward edge
            lowlink[v] = min(lowlink[v], ord[u]);
        }
    }
}

vector<PII> calc_bridge(int N)
{
    vector<PII> res;
    for (int v=0; v<N; v++) {
        for (auto u : G[v]) {
            if (ord[v] < lowlink[u]) {
                res.emplace_back(min(v, u), max(v, u));
            }
        }
    }
    return res;
}


int main()
{
    int N, M;
    cin >> N >> M;

    rep(i, M) {
        int U, V;
        cin >> U >> V;
        // U--, V--;
        G[U].push_back(V);
        G[V].push_back(U);
    }

    calc_lowlink(0);
    vector<PII> bridges = calc_bridge(N);
    sort(bridges.begin(), bridges.end());

    for (auto p : bridges) {
        cout << p.first << " " << p.second << endl;
    }

    /*
    rep(i, N) {
        cout << ord[i] << " " <<  lowlink[i] << endl;
    }
    */
}
### Prompt

Your task is to create a Cpp solution to the following problem:

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 DUMP(x) cerr << #x << "=" << x << endl
#define DUMP2(x, y) cerr<<"("<<#x<<", "<<#y<<") = ("<<x<<", "<<y<<")"<< endl
#define BINARY(x) static_cast<bitset<16> >(x)

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define REP(i,m,n) for (int i=m;i<(int)(n);i++)

#define in_range(x, y, w, h) (0<=(int)(x) && (int)(x)<(int)(w) && 0<=(int)(y) && (int)(y)<(int)(h))
#define ALL(a) (a).begin(),(a).end()

typedef long long ll;
const int INF = 1e9;
typedef pair<int, int> PII;
int dx[4]={0, -1, 1, 0}, dy[4]={-1, 0, 0, 1};


const int MAX_V = 1e5;
vector<int> G[MAX_V];

set<int> used_v;
set<PII> used_e;
int ord[MAX_V], lowlink[MAX_V];
int k = 0;

void calc_lowlink(int v)
{
    used_v.insert(v);
    ord[v] = lowlink[v] = k++;

    for (auto u : G[v]) {
        if (!used_v.count(u)) {
            used_e.insert(PII(v, u));
            calc_lowlink(u);
            lowlink[v] = min(lowlink[v], lowlink[u]);
        } else if (!used_e.count(PII(u, v))) {
            // backward edge
            lowlink[v] = min(lowlink[v], ord[u]);
        }
    }
}

vector<PII> calc_bridge(int N)
{
    vector<PII> res;
    for (int v=0; v<N; v++) {
        for (auto u : G[v]) {
            if (ord[v] < lowlink[u]) {
                res.emplace_back(min(v, u), max(v, u));
            }
        }
    }
    return res;
}


int main()
{
    int N, M;
    cin >> N >> M;

    rep(i, M) {
        int U, V;
        cin >> U >> V;
        // U--, V--;
        G[U].push_back(V);
        G[V].push_back(U);
    }

    calc_lowlink(0);
    vector<PII> bridges = calc_bridge(N);
    sort(bridges.begin(), bridges.end());

    for (auto p : bridges) {
        cout << p.first << " " << p.second << endl;
    }

    /*
    rep(i, N) {
        cout << ord[i] << " " <<  lowlink[i] << endl;
    }
    */
}
```