#include <bits/stdc++.h>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define iter(c) __typeof((c).begin())
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
#define pb(a) push_back(a)
#define pr(a) cout<<(a)<<endl
#define PR(a,b) cout<<(a)<<" "<<(b)<<endl
#define F first
#define S second
#define ll long long
bool check(int n,int m,int x,int y){return (x<0||x>=n||y<0||y>=m)?false:true;}
const ll MAX=1000000007,MAXL=1LL<<60,dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
typedef pair<int,int> P;

int ord[100001],low[100001];
vector<int> G[100001];
struct edge{int u,v;};
void dfs(int u, int pre, int c, vector<int> G[], vector<edge> &B){
  ord[u] = low[u] = c++;
  for(int i=0;i<G[u].size();i++){
    int v = G[u][i];
    if(v != pre){
      if(ord[v] == -1){
        dfs(v,u,c,G,B);
        low[u] = min(low[u],low[v]);
      } else low[u] = min(low[u],ord[v]);
      if(ord[u] < low[v]) B.push_back((edge){u,v});
    }
  }
}

void bridge(int n, vector<int> G[], vector<edge> &B){
  B.clear();
  int c = 0;
  fill(ord,ord+n,-1);
  for(int i=0;i<n;i++) if(ord[i]==-1) dfs(i,-1,c,G,B);
}

int main() {
  int n,m;
  cin >> n >> m;
  rep(i,m) {
    int x,y;
    cin >> x >> y;
    G[x].pb(y);
    G[y].pb(x);
  }

  vector<edge> E;
  bridge(n,G,E);
  vector<P> ans;
  rep(i,E.size()) {
    if(E[i].u>E[i].v) swap(E[i].u,E[i].v);
    ans.pb(P(E[i].u,E[i].v));
  }
  sort(all(ans));
  rep(i,ans.size()) PR(ans[i].F,ans[i].S);
  return 0;
}

### Prompt

In cpp, your task is to solve 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>
using namespace std;
#define all(c) (c).begin(),(c).end()
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define iter(c) __typeof((c).begin())
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
#define pb(a) push_back(a)
#define pr(a) cout<<(a)<<endl
#define PR(a,b) cout<<(a)<<" "<<(b)<<endl
#define F first
#define S second
#define ll long long
bool check(int n,int m,int x,int y){return (x<0||x>=n||y<0||y>=m)?false:true;}
const ll MAX=1000000007,MAXL=1LL<<60,dx[4]={-1,0,1,0},dy[4]={0,-1,0,1};
typedef pair<int,int> P;

int ord[100001],low[100001];
vector<int> G[100001];
struct edge{int u,v;};
void dfs(int u, int pre, int c, vector<int> G[], vector<edge> &B){
  ord[u] = low[u] = c++;
  for(int i=0;i<G[u].size();i++){
    int v = G[u][i];
    if(v != pre){
      if(ord[v] == -1){
        dfs(v,u,c,G,B);
        low[u] = min(low[u],low[v]);
      } else low[u] = min(low[u],ord[v]);
      if(ord[u] < low[v]) B.push_back((edge){u,v});
    }
  }
}

void bridge(int n, vector<int> G[], vector<edge> &B){
  B.clear();
  int c = 0;
  fill(ord,ord+n,-1);
  for(int i=0;i<n;i++) if(ord[i]==-1) dfs(i,-1,c,G,B);
}

int main() {
  int n,m;
  cin >> n >> m;
  rep(i,m) {
    int x,y;
    cin >> x >> y;
    G[x].pb(y);
    G[y].pb(x);
  }

  vector<edge> E;
  bridge(n,G,E);
  vector<P> ans;
  rep(i,E.size()) {
    if(E[i].u>E[i].v) swap(E[i].u,E[i].v);
    ans.pb(P(E[i].u,E[i].v));
  }
  sort(all(ans));
  rep(i,ans.size()) PR(ans[i].F,ans[i].S);
  return 0;
}

```