#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define vi vector<int>
#define pb push_back
#define INF 999999999
//#define INF (1LL<<59)


#define MAX_V 100000
vector<int> G[MAX_V];

void visit(int cur, int prev, vector<pii> &brg, vector<vector<int>> &each_bcc, stack<int> &roots, stack<int> &S, vector<bool> &inS, vector<int> &order, int &k){
	order[cur] = ++k;
	S.push(cur); inS[cur] = true;
	roots.push(cur);
	
	rep(i,G[cur].size()){
		int to = G[cur][i];
		if(order[to]==0){
			visit(to,cur,brg,each_bcc,roots,S,inS,order,k);
		}
		else if(to!=prev && inS[to]){	//?????????????????????
			while(order[roots.top()] > order[to]) roots.pop();	//cur???to?????§(to???????????????)????????????roots????????¨??????
		}
	}

	if(cur==roots.top()&&prev!=-1){
		brg.pb(pii(prev,cur));
		vector<int> bcc;
		while(1){
			int node = S.top(); S.pop(); inS[node] = false;
			bcc.pb(node);
			if(node==cur)break;
		}
		each_bcc.pb(bcc);
		roots.pop();
	}
}


void bridge(int V, vector<pii> &brg, vector<vector<int>> &each_bcc){
	vector<int> order(V);
	vector<bool> inS(V);
	stack<int> roots, S;
	int k=0;
	rep(i,V){
		if(order[i]==0){
			visit(i,-1,brg,each_bcc,roots,S,inS,order,k);
		}
	}
}



int main(){
	int v,e;
	cin>>v>>e;
	vector<pii> edges;
	rep(i,e){
		int s,t;
		cin>>s>>t;
		edges.pb(pii(s,t));
		G[s].pb(t);
		G[t].pb(s);
	}
	
	vector<pii> brg;
	vector<vector<int>> each_bcc;
	
	bridge(v,brg,each_bcc);
	
	vector<pii> ans;

	rep(i,brg.size()){
		if(brg[i].first<brg[i].second)ans.pb(pii(brg[i].first,brg[i].second));
		else ans.pb(pii(brg[i].second,brg[i].first));
	}
	
	
	sort(all(ans));
	rep(i,ans.size())cout<<ans[i].first<<" "<<ans[i].second<<endl;
}
### 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"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a)  (a).begin(),(a).end()
#define vi vector<int>
#define pb push_back
#define INF 999999999
//#define INF (1LL<<59)


#define MAX_V 100000
vector<int> G[MAX_V];

void visit(int cur, int prev, vector<pii> &brg, vector<vector<int>> &each_bcc, stack<int> &roots, stack<int> &S, vector<bool> &inS, vector<int> &order, int &k){
	order[cur] = ++k;
	S.push(cur); inS[cur] = true;
	roots.push(cur);
	
	rep(i,G[cur].size()){
		int to = G[cur][i];
		if(order[to]==0){
			visit(to,cur,brg,each_bcc,roots,S,inS,order,k);
		}
		else if(to!=prev && inS[to]){	//?????????????????????
			while(order[roots.top()] > order[to]) roots.pop();	//cur???to?????§(to???????????????)????????????roots????????¨??????
		}
	}

	if(cur==roots.top()&&prev!=-1){
		brg.pb(pii(prev,cur));
		vector<int> bcc;
		while(1){
			int node = S.top(); S.pop(); inS[node] = false;
			bcc.pb(node);
			if(node==cur)break;
		}
		each_bcc.pb(bcc);
		roots.pop();
	}
}


void bridge(int V, vector<pii> &brg, vector<vector<int>> &each_bcc){
	vector<int> order(V);
	vector<bool> inS(V);
	stack<int> roots, S;
	int k=0;
	rep(i,V){
		if(order[i]==0){
			visit(i,-1,brg,each_bcc,roots,S,inS,order,k);
		}
	}
}



int main(){
	int v,e;
	cin>>v>>e;
	vector<pii> edges;
	rep(i,e){
		int s,t;
		cin>>s>>t;
		edges.pb(pii(s,t));
		G[s].pb(t);
		G[t].pb(s);
	}
	
	vector<pii> brg;
	vector<vector<int>> each_bcc;
	
	bridge(v,brg,each_bcc);
	
	vector<pii> ans;

	rep(i,brg.size()){
		if(brg[i].first<brg[i].second)ans.pb(pii(brg[i].first,brg[i].second));
		else ans.pb(pii(brg[i].second,brg[i].first));
	}
	
	
	sort(all(ans));
	rep(i,ans.size())cout<<ans[i].first<<" "<<ans[i].second<<endl;
}
```