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;

vector<pair<int, int> > bridge;
vector<int> graph[100010];
pair<int, int> edge[200010];
vector<pair<int, int> > treeGraph[200010];

int pre[100010];
int low[100010];
int com[100010];
int n, m;
int visited_cnt = 0;

int dis_dfs(int idx, int from){
    pre[idx] = visited_cnt;
    visited_cnt++;
    low[idx] = pre[idx];

    for(int i = 0;i < graph[idx].size();i++){
        int to = graph[idx][i];
        if(pre[to] == -1){
            low[idx] = min(low[idx], dis_dfs(to, idx));
            if(low[to] == pre[to]){
                //bridge.push_back(make_pair(min(idx, to), max(idx, to)));
            }
        }else{
            if(from != to){
                low[idx] = min(low[idx], low[to]);
            }
        }
    }

    return low[idx];
}

void disGraph(){
    memset(pre, -1, sizeof(pre));
    memset(low, -1, sizeof(low));

    dis_dfs(0, -1);

    for(int i = 0;i < m;i++){
        int fi = edge[i].first;
        int se = edge[i].second;
        if(pre[fi] < low[se] || pre[se] < low[fi]){
            bridge.push_back(make_pair(min(fi, se), max(se, fi)));
        }
    }

}

int main(){
    cin >> n >> m;

    for(int i = 0;i < m;i++){
        cin >> edge[i].first >> edge[i].second;
        //edge[i].first--, edge[i].second--;
        graph[edge[i].first].push_back(edge[i].second);
        graph[edge[i].second].push_back(edge[i].first);
    }

    disGraph();

    sort(bridge.begin(), bridge.end());

    for(int i = 0;i < bridge.size();i++){
        cout << bridge[i].first << " " << bridge[i].second << endl;
    }

    return 0;
}