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

Solution (in CPP):

Solution:
#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};

class LowLink {
    const int N;
    vector<vector<int>> G;
    set<int> used_v;
    vector<int> ord, low, parent;

    void dfs(int v, int &k)
    {
        used_v.insert(v);
        ord[v] = low[v] = k++;

        for (auto u : G[v]) {
            if (u == parent[v]) continue;
            if (!used_v.count(u)) {
                parent[u] = v;
                dfs(u, k);
                low[v] = min(low[v], low[u]);
            } else {
                low[v] = min(low[v], ord[u]);
            }

            if (ord[v] < low[u]) bridges.emplace_back(min(u, v), max(u, v));
        }
    }

public:
    vector<PII> bridges;
    LowLink(int _N) : N(_N), G(_N), ord(_N), low(_N), parent(_N) {}

    void compute_bridge()
    {
        int k = 0;
        bridges.clear();
        dfs(0, k);
    }

    void add_edge(int u, int v)
    {
        G[u].push_back(v);
        G[v].push_back(u);
    }
};


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

    LowLink llink(N);

    rep(i, M) {
        int U, V;
        cin >> U >> V;
        llink.add_edge(U, V);
    }

    llink.compute_bridge();
    sort(llink.bridges.begin(), llink.bridges.end());

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

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