#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];
bool used[MAX_V];
int ord[MAX_V],lowlink[MAX_V];
int k=0;


void dfs(int v,int p){	//make ord and lowlink
	used[v] = true;
	ord[v]=lowlink[v]=k;
	k++;
	
	rep(i,G[v].size()){
		int to = G[v][i];
		if(!used[to]){
			dfs(to,v);
			lowlink[v] = min(lowlink[v],lowlink[to]);
		}
		else if(used[to]&&to!=p){	//use back edge
			lowlink[v] = min(lowlink[v],ord[to]);
		}
	}
}

vector<pii> enumerateBridge(int e,vector<pii> edges){	//????????????
	vector<pii> ret;
	
	rep(i,e){
		int a = edges[i].first, b = edges[i].second;
		if(ord[a]>ord[b])swap(a,b);
		if(ord[a]<lowlink[b])ret.pb(pii(edges[i].first,edges[i].second));
	}
	return ret;
}


int main(){
	int v,e;
	cin>>v>>e;
	vector<pii> edges;
	rep(i,e){
		int s,t;
		cin>>s>>t;
		if(s>t)swap(s,t);
		edges.pb(pii(s,t));
		G[s].pb(t);
		G[t].pb(s);
	}
	
	dfs(0,-1);
	
	vector<pii> ans = enumerateBridge(e,edges);
	
	sort(all(ans));
	rep(i,ans.size())cout<<ans[i].first<<" "<<ans[i].second<<endl;
}
### 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;
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];
bool used[MAX_V];
int ord[MAX_V],lowlink[MAX_V];
int k=0;


void dfs(int v,int p){	//make ord and lowlink
	used[v] = true;
	ord[v]=lowlink[v]=k;
	k++;
	
	rep(i,G[v].size()){
		int to = G[v][i];
		if(!used[to]){
			dfs(to,v);
			lowlink[v] = min(lowlink[v],lowlink[to]);
		}
		else if(used[to]&&to!=p){	//use back edge
			lowlink[v] = min(lowlink[v],ord[to]);
		}
	}
}

vector<pii> enumerateBridge(int e,vector<pii> edges){	//????????????
	vector<pii> ret;
	
	rep(i,e){
		int a = edges[i].first, b = edges[i].second;
		if(ord[a]>ord[b])swap(a,b);
		if(ord[a]<lowlink[b])ret.pb(pii(edges[i].first,edges[i].second));
	}
	return ret;
}


int main(){
	int v,e;
	cin>>v>>e;
	vector<pii> edges;
	rep(i,e){
		int s,t;
		cin>>s>>t;
		if(s>t)swap(s,t);
		edges.pb(pii(s,t));
		G[s].pb(t);
		G[t].pb(s);
	}
	
	dfs(0,-1);
	
	vector<pii> ans = enumerateBridge(e,edges);
	
	sort(all(ans));
	rep(i,ans.size())cout<<ans[i].first<<" "<<ans[i].second<<endl;
}
```