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 <iostream>
#include <algorithm>
#include <vector>
using namespace std;

int N, M, A[200009], B[200009], pre[200009], low[200009], cnts;
vector<pair<int, int>> X[200009];
vector<int> G;

void dfs(int pos, int par) {
	cnts++;
	pre[pos] = cnts; low[pos] = cnts;
	for (int i = 0; i < X[pos].size(); i++) {
		int to = X[pos][i].first;
		if (low[to] == (1 << 30)) {
			dfs(to, pos);
			low[pos] = min(low[pos], low[to]);
			if (low[to] == pre[to]) {
				G.push_back(X[pos][i].second);
			}
		}
		else {
			if (to == par) continue;
			low[pos] = min(low[pos], low[to]);
		}
	}
}

int main() {
	cin >> N >> M;
	for (int i = 1; i <= M; i++) {
		cin >> A[i] >> B[i]; if (A[i] > B[i]) swap(A[i], B[i]);
		X[A[i]].push_back(make_pair(B[i], i));
		X[B[i]].push_back(make_pair(A[i], i));
	}
	for (int i = 0; i <= N; i++) { pre[i] = (1 << 30); low[i] = (1 << 30); }
	dfs(0, -1);
	vector<pair<int, int>>F;
	for (int i = 0; i < G.size(); i++) {
		F.push_back(make_pair(A[G[i]], B[G[i]]));
	}
	sort(F.begin(), F.end());
	for (int i = 0; i < F.size(); i++) cout << F[i].first << " " << F[i].second << endl;
	return 0;
}