#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); i ++)
using namespace std;
using ll = long long;
using PL = pair<ll,ll>;
using P = pair<int,int>;
constexpr int INF = 1000000000;
constexpr long long HINF = 1000000000000000;
constexpr long long MOD = 1000000007;
constexpr double EPS = 1e-4;
constexpr double PI = 3.14159265358979;

struct LowLink {
    int N;
    vector<vector<int>> G;
    vector<int> low,ord,articulation;
    vector<P> bridge;

    LowLink(int N, vector<vector<int>> &G): N(N),G(G),low(N,-1),ord(N,-1) {}

    void dfs(int v,int time,int p = -1) {
        ord[v] = low[v] = time;
        ++time;

        bool isArticulation = false;
        int cnt = 0;

        for (int e:G[v]) {
            if (low[e] < 0) {
                ++cnt;
                dfs(e,time,v);
                low[v] = min(low[v],low[e]);
                if (p != -1 && ord[v] <= low[e]) isArticulation = true;
                if (ord[v] < low[e]) {
                    if (v < e) bridge.push_back({v,e});
                    else bridge.push_back({e,v});
                }
            }
            else if (p != e) {
                low[v] = min(low[v],ord[e]);
            }
        }

        if (p == -1 && cnt >= 2) isArticulation = true;
        if (isArticulation) articulation.push_back(v);
    }

    void build() {
        dfs(0,0);
    }
};

int main() {
    int V,E; cin >> V >> E;
    vector<vector<int>> G(V);
    rep(_,E) {
        int a,b; cin >> a >> b;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    LowLink lol(V,G);
    lol.build();
    vector<P> ans = lol.bridge;
    sort(ans.begin(),ans.end());
    rep(i,ans.size()) printf("%d %d\n",ans[i].first,ans[i].second);
    return 0;
}

### Prompt

Generate 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,n) for (int i = 0; i < (n); i ++)
using namespace std;
using ll = long long;
using PL = pair<ll,ll>;
using P = pair<int,int>;
constexpr int INF = 1000000000;
constexpr long long HINF = 1000000000000000;
constexpr long long MOD = 1000000007;
constexpr double EPS = 1e-4;
constexpr double PI = 3.14159265358979;

struct LowLink {
    int N;
    vector<vector<int>> G;
    vector<int> low,ord,articulation;
    vector<P> bridge;

    LowLink(int N, vector<vector<int>> &G): N(N),G(G),low(N,-1),ord(N,-1) {}

    void dfs(int v,int time,int p = -1) {
        ord[v] = low[v] = time;
        ++time;

        bool isArticulation = false;
        int cnt = 0;

        for (int e:G[v]) {
            if (low[e] < 0) {
                ++cnt;
                dfs(e,time,v);
                low[v] = min(low[v],low[e]);
                if (p != -1 && ord[v] <= low[e]) isArticulation = true;
                if (ord[v] < low[e]) {
                    if (v < e) bridge.push_back({v,e});
                    else bridge.push_back({e,v});
                }
            }
            else if (p != e) {
                low[v] = min(low[v],ord[e]);
            }
        }

        if (p == -1 && cnt >= 2) isArticulation = true;
        if (isArticulation) articulation.push_back(v);
    }

    void build() {
        dfs(0,0);
    }
};

int main() {
    int V,E; cin >> V >> E;
    vector<vector<int>> G(V);
    rep(_,E) {
        int a,b; cin >> a >> b;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    LowLink lol(V,G);
    lol.build();
    vector<P> ans = lol.bridge;
    sort(ans.begin(),ans.end());
    rep(i,ans.size()) printf("%d %d\n",ans[i].first,ans[i].second);
    return 0;
}

```