#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <bitset>
#include <complex>
using namespace std;
#define REP(i,n) for(int i = 0; i < (int)n; i++)
#define FOR(i,a,b) for(int i = a; i < (int)b; i++)
#define pb push_back
#define mp make_pair
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef long long ll;
typedef unsigned long long ull;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
const int INF = 1 << 27;

//////////////////////////////
// ????????? (?????¨????????????????????????????????¨??°?????????2???????????????????????????????????????
int dfs(int u, int prev, int *cnt, int *prenum, int *lowest, vector< vector<int> > &v, vector<pi> &res){
  prenum[u] = lowest[u] = ++(*cnt);
  REP(i, v[u].size()){
    int next = v[u][i];
    if(prenum[next] == -1){
      lowest[u] = min(lowest[u], dfs(next, u, cnt, prenum, lowest, v, res));
      if(lowest[next] == prenum[next]) res.push_back(pi(min(u, next), max(u, next)));
    }
    else if(prev != next)
      lowest[u] = min(lowest[u], lowest[next]);
  }
  return lowest[u];
}
vector<pi> bridges(int V, int E, vector< vector<int> > &v){
  int prenum[V], lowest[V];
  memset(prenum, -1, sizeof(prenum));
  int tmp = 1;
  vector<pi> res;
  dfs(0, -1, &tmp, prenum, lowest, v, res);
  return res;
}
int main() {
	int v, e; cin >> v >> e;
	vector<vi> vvi(v);
	REP(i, e) {
		int a,b; cin >> a >> b;
		vvi[a].pb(b);
		vvi[b].pb(a);
	}
	vector<pi> ans = bridges(v, e, vvi);
	sort(ans.begin(), ans.end());
	REP(i, ans.size())
		cout << ans[i].first << ' '<< ans[i].second << endl;
	return 0;
}
### Prompt

Please formulate a Cpp solution 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 <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <bitset>
#include <complex>
using namespace std;
#define REP(i,n) for(int i = 0; i < (int)n; i++)
#define FOR(i,a,b) for(int i = a; i < (int)b; i++)
#define pb push_back
#define mp make_pair
typedef vector<int> vi;
typedef pair<int, int> pi;
typedef long long ll;
typedef unsigned long long ull;
const int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};
const int INF = 1 << 27;

//////////////////////////////
// ????????? (?????¨????????????????????????????????¨??°?????????2???????????????????????????????????????
int dfs(int u, int prev, int *cnt, int *prenum, int *lowest, vector< vector<int> > &v, vector<pi> &res){
  prenum[u] = lowest[u] = ++(*cnt);
  REP(i, v[u].size()){
    int next = v[u][i];
    if(prenum[next] == -1){
      lowest[u] = min(lowest[u], dfs(next, u, cnt, prenum, lowest, v, res));
      if(lowest[next] == prenum[next]) res.push_back(pi(min(u, next), max(u, next)));
    }
    else if(prev != next)
      lowest[u] = min(lowest[u], lowest[next]);
  }
  return lowest[u];
}
vector<pi> bridges(int V, int E, vector< vector<int> > &v){
  int prenum[V], lowest[V];
  memset(prenum, -1, sizeof(prenum));
  int tmp = 1;
  vector<pi> res;
  dfs(0, -1, &tmp, prenum, lowest, v, res);
  return res;
}
int main() {
	int v, e; cin >> v >> e;
	vector<vi> vvi(v);
	REP(i, e) {
		int a,b; cin >> a >> b;
		vvi[a].pb(b);
		vvi[b].pb(a);
	}
	vector<pi> ans = bridges(v, e, vvi);
	sort(ans.begin(), ans.end());
	REP(i, ans.size())
		cout << ans[i].first << ' '<< ans[i].second << endl;
	return 0;
}
```