#include <bits/stdc++.h>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

class Graph{
	private:
	int n;
	vvi g;
	vi imos,big,dep;
	vp edge;
	void Bdfs(int v,int d){
		dep[v]=d;
		for(auto u:g[v]) if(dep[u]==-1) Bdfs(u,d+1);
	}
	int BDFS(int v){
		int d=dep[v],S=0;
		for(auto u:g[v]){
			int D=dep[u];
			if(D==d-1) continue;
			if(D==d+1) S+=BDFS(u);
			else if(D<d) S++;
			else S--;
		}
		return imos[v]=S;
	}
	void BDfs(int v,int t,int& id){
		big[v]=t;
		for(auto u:g[v]) if(dep[u]==dep[v]+1){
			if(imos[u]) BDfs(u,t,id);
			else{
				id++;
				BDfs(u,id,id);
			}
		}
	}
	int Biconnect(){
		imos=big=vi(n);
		dep=vi(n,-1);
		int t=0;
		Bdfs(0,0);BDFS(0);BDfs(0,0,t);
		return t+1;
	}
	public:
	Graph(int v){
		n=v;
		g=vvi(v);
	}
	void add_edge(int s,int t){
		g[s].push_back(t);
		g[t].push_back(s);
	}
	void solve(){
		int N=Biconnect();
		vp a;
		for(int u=0;u<n;u++) for(auto v:g[u]) if(big[u]<big[v])a.push_back({min(u,v),max(u,v)});
		sort(a.begin(),a.end());
		for(auto p:a) cout<<p.first<<' '<<p.second<<endl;
	}
};

int n,m;

int main(){
	cin>>n>>m;
	Graph g(n);
	for(int i=0;i<m;i++){
		int u,v;
		cin>>u>>v;
		g.add_edge(u,v);
	}
	g.solve();
}

### Prompt

Please create a solution in cpp 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>
#define syosu(x) fixed<<setprecision(x)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef pair<double,double> pdd;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<string> vs;
typedef vector<P> vp;
typedef vector<vp> vvp;
typedef vector<pll> vpll;
typedef pair<int,P> pip;
typedef vector<pip> vip;
const int inf=1<<30;
const ll INF=1ll<<60;
const double pi=acos(-1);
const double eps=1e-9;
const ll mod=1e9+7;
const int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

class Graph{
	private:
	int n;
	vvi g;
	vi imos,big,dep;
	vp edge;
	void Bdfs(int v,int d){
		dep[v]=d;
		for(auto u:g[v]) if(dep[u]==-1) Bdfs(u,d+1);
	}
	int BDFS(int v){
		int d=dep[v],S=0;
		for(auto u:g[v]){
			int D=dep[u];
			if(D==d-1) continue;
			if(D==d+1) S+=BDFS(u);
			else if(D<d) S++;
			else S--;
		}
		return imos[v]=S;
	}
	void BDfs(int v,int t,int& id){
		big[v]=t;
		for(auto u:g[v]) if(dep[u]==dep[v]+1){
			if(imos[u]) BDfs(u,t,id);
			else{
				id++;
				BDfs(u,id,id);
			}
		}
	}
	int Biconnect(){
		imos=big=vi(n);
		dep=vi(n,-1);
		int t=0;
		Bdfs(0,0);BDFS(0);BDfs(0,0,t);
		return t+1;
	}
	public:
	Graph(int v){
		n=v;
		g=vvi(v);
	}
	void add_edge(int s,int t){
		g[s].push_back(t);
		g[t].push_back(s);
	}
	void solve(){
		int N=Biconnect();
		vp a;
		for(int u=0;u<n;u++) for(auto v:g[u]) if(big[u]<big[v])a.push_back({min(u,v),max(u,v)});
		sort(a.begin(),a.end());
		for(auto p:a) cout<<p.first<<' '<<p.second<<endl;
	}
};

int n,m;

int main(){
	cin>>n>>m;
	Graph g(n);
	for(int i=0;i<m;i++){
		int u,v;
		cin>>u>>v;
		g.add_edge(u,v);
	}
	g.solve();
}

```