#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef pair<int, int> P;

int n, m;
vector<int> G[100010];
bool f[100010];
int ord[100010], low[100010];
vector<P> bridge;

void dfs(int v, int p, int &k){
    ord[v] = k++;
    low[v] = ord[v];
    f[v] = true;
    rep(i, 0, G[v].size()){
        int u = G[v][i];
        if(f[u]){
            if(u != p) low[v] = min(low[v], ord[u]);
        }else{
            dfs(u, v, k);
            if(ord[v] < low[u]) bridge. push_back(P(min(v, u), max(v, u)));
            low[v] = min(low[v], low[u]);
        }
    }
}

signed main(){
    cin >> n >> m;
    rep(i, 0, m){
        int a, b;
        cin >> a >> b;
        G[a]. push_back(b);
        G[b]. push_back(a);
    }
    int k = 0;
    dfs(0, -1, k);
    sort(all(bridge));
    rep(i, 0, bridge.size()){
        cout << bridge[i].fi << " " << bridge[i].se << 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>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define o(a) cout << a << endl
#define int long long
#define fi first
#define se second
using namespace std;
typedef pair<int, int> P;

int n, m;
vector<int> G[100010];
bool f[100010];
int ord[100010], low[100010];
vector<P> bridge;

void dfs(int v, int p, int &k){
    ord[v] = k++;
    low[v] = ord[v];
    f[v] = true;
    rep(i, 0, G[v].size()){
        int u = G[v][i];
        if(f[u]){
            if(u != p) low[v] = min(low[v], ord[u]);
        }else{
            dfs(u, v, k);
            if(ord[v] < low[u]) bridge. push_back(P(min(v, u), max(v, u)));
            low[v] = min(low[v], low[u]);
        }
    }
}

signed main(){
    cin >> n >> m;
    rep(i, 0, m){
        int a, b;
        cin >> a >> b;
        G[a]. push_back(b);
        G[b]. push_back(a);
    }
    int k = 0;
    dfs(0, -1, k);
    sort(all(bridge));
    rep(i, 0, bridge.size()){
        cout << bridge[i].fi << " " << bridge[i].se << endl;
    }
}
```