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 <bits/stdc++.h>
using namespace std;

#define fi first
#define se second
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define each(itr,v) for(auto itr:v)
#define pb(s) push_back(s)
#define mp(a,b) make_pair(a,b)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define maxch(x,y) x=max(x,y)
#define minch(x,y) x=min(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt(x) bitset<32>(x).count()

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> P;
typedef pair<P, int> PPI;
typedef pair<ll, ll> PL;
typedef pair<P, ll> PPL;

#define INF INT_MAX/3

#define MAX_N 100010

vector<int> G[MAX_N];
int n,m;
int num[MAX_N],par[MAX_N],low[MAX_N];
int cnt;
vector<pair<int,int> > res;

void bridge(int v,int prev){
	num[v]=low[v]=++cnt;
	for(int i=0;i<G[v].size();i++){
		int nv=G[v][i];
		if(num[nv]==-1){
			par[nv]=v;
			bridge(nv,v);
			low[v]=min(low[v],low[nv]);
			if(num[v]<low[nv]){
				res.push_back(make_pair(min(v,nv),max(v,nv)));
			}
		}else if(nv!=prev){
			low[v]=min(low[v],num[nv]);
		}
	}
}

int main(){
	cin.sync_with_stdio(false);
	cin>>n>>m;
	rep(i,m){
		int a,b;
		cin>>a>>b;
		G[a].pb(b); G[b].pb(a);
	}
	memset(num,-1,sizeof(num));
	cnt=0;
	bridge(0,-1);
	sort(all(res));
	rep(i,res.size()){
		cout<<res[i].fi<<" "<<res[i].se<<endl;
	}
	return 0;
}