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<iostream>
#include<vector>
#include<set>
using namespace std;

typedef vector<vector<int> > Graph;
typedef pair<int, int> pii;
struct Node{
  int order, min_order;
};
class BrigeFind{
public:
  BrigeFind(Graph _g){
    g = _g;
    node.resize(g.size(), Node{-1, (int)1e9});
  }
  set<pii> find(){
    if(current_order == 0)dfs();
    return brige;
  }
private:
  void dfs(int current  = 0,
           int previous = -1){
    node[current].order   = current_order;
    node[current].min_order = current_order++;
    int to;
    for (int i = 0; i < g[current].size(); i++) {
      to = g[current][i];
      if(node[to].order == -1) dfs(to, current);
      if(previous == to)continue;
      node[current].min_order =
        min(node[current].min_order,
            node[to].min_order);
    }
    if(node[current].min_order == node[current].order and
       previous != -1){
      if(previous < current)
        brige.insert(pii(previous, current));
      else
        brige.insert(pii(current, previous));
    }
  }
  int current_order = 0;
  set<pii> brige;
  Graph g;
  vector<Node> node;
};

int main(int argc, char *argv[]){
  int n, m;
  std::cin >> n >> m;
  Graph g(n, vector<int>());
  for (int i = 0; i < m; i++) {
    int to, from;
    std::cin >> to >> from;
    g[to].push_back(from);
    g[from].push_back(to);
  }
  BrigeFind bf(g);
  set<pii> bridge = bf.find();
  for (auto i: bridge){
    std::cout << i.first << " " << i.second << std::endl;
  }
  return 0;
}