
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
using namespace std;
using LL = long long;

//??°?????????lowlink???????????????????????¢????????¨??????????????????
//?¨??????? O(|V|+|E|)
void lowlink(vector<int>graph[], int n, vector<int>&low, vector<pair<int, int>>&br, vector<int>&jnt) {
	low.resize(n);
	vector<int>ord(n);//DFS?????????
	vector<bool>vis(n);//?¨???????????????????
	//?????°????????????
	function<void(int, int, int&)>dfs = [&](int v, int p, int &k) {
		vis[v] = true;
		ord[v] = k++;
		low[v] = ord[v];
		bool joint = false;
		int cnt = 0;
		for (auto nxt : graph[v]) {
			if (!vis[nxt]) {
				cnt++;
				dfs(nxt, v, k);
				low[v] = min(low[v], low[nxt]);
				if (p >= 0 && ord[v] <= low[nxt]) joint = true;
				if (ord[v] < low[nxt])br.push_back({ min(v,nxt),max(v,nxt) });
			}
			else if (nxt != p) {
				low[v] = min(low[v], ord[nxt]);
			}
		}
		if (p < 0 && cnt > 1) joint = true;
		if (joint) jnt.push_back(v);
	};
	int k = 0;
	for (int i = 0; i < n; ++i)
		if (!vis[i])dfs(i, -1, k);
}

int N, M;
vector<int>graph[123456];

int main(void)
{
	cin >> N >> M;
	for (int i = 0; i < M; ++i) {
		int s, t;
		cin >> s >> t;
		graph[s].push_back(t);
		graph[t].push_back(s);
	}
	vector<int>low, jnt;
	vector<pair<int, int>>br;
	lowlink(graph, N, low, br, jnt);
	sort(br.begin(), br.end());
	for (auto i : br) {
		cout << i.first << " " << i.second << endl;
	}
	return 0;
}
### 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 <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <cstring>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <array>
#include <cassert>
#include <bitset>
using namespace std;
using LL = long long;

//??°?????????lowlink???????????????????????¢????????¨??????????????????
//?¨??????? O(|V|+|E|)
void lowlink(vector<int>graph[], int n, vector<int>&low, vector<pair<int, int>>&br, vector<int>&jnt) {
	low.resize(n);
	vector<int>ord(n);//DFS?????????
	vector<bool>vis(n);//?¨???????????????????
	//?????°????????????
	function<void(int, int, int&)>dfs = [&](int v, int p, int &k) {
		vis[v] = true;
		ord[v] = k++;
		low[v] = ord[v];
		bool joint = false;
		int cnt = 0;
		for (auto nxt : graph[v]) {
			if (!vis[nxt]) {
				cnt++;
				dfs(nxt, v, k);
				low[v] = min(low[v], low[nxt]);
				if (p >= 0 && ord[v] <= low[nxt]) joint = true;
				if (ord[v] < low[nxt])br.push_back({ min(v,nxt),max(v,nxt) });
			}
			else if (nxt != p) {
				low[v] = min(low[v], ord[nxt]);
			}
		}
		if (p < 0 && cnt > 1) joint = true;
		if (joint) jnt.push_back(v);
	};
	int k = 0;
	for (int i = 0; i < n; ++i)
		if (!vis[i])dfs(i, -1, k);
}

int N, M;
vector<int>graph[123456];

int main(void)
{
	cin >> N >> M;
	for (int i = 0; i < M; ++i) {
		int s, t;
		cin >> s >> t;
		graph[s].push_back(t);
		graph[t].push_back(s);
	}
	vector<int>low, jnt;
	vector<pair<int, int>>br;
	lowlink(graph, N, low, br, jnt);
	sort(br.begin(), br.end());
	for (auto i : br) {
		cout << i.first << " " << i.second << endl;
	}
	return 0;
}
```