#include <iostream>
#include <vector>
#include <algorithm>
#define pii pair<int,int>
#define S second
#define F first

using namespace std;
const int MAX_N = 1e5+10;
const int INF = 1e9+10;
int from[MAX_N],to[MAX_N],DP[MAX_N],depth[MAX_N];
vector <int> vec[MAX_N];
vector <pii> ans;
bool mark[MAX_N];
void dfs(int v,int cnt,int l){
    mark[v]=true;
    depth[v]=cnt;
    for(int en:vec[v]){
        if(en==l)
            continue;
        int u=to[en]^from[en]^v;
        if(mark[u])
            DP[v]=min(DP[v],depth[u]);
        else{
            dfs(u,cnt+1,en);
            DP[v]=min(DP[v],DP[u]);
        }
    }
    if(DP[v]>=depth[v]&&l!=-1)
        ans.push_back({from[l],to[l]});
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n,m;
    cin>>n>>m;
    if(n==1)
        return 0;
    fill(DP,DP+max(n,m),INF);
    for(int i=0;i<m;i++){
        cin>>from[i]>>to[i];
        if(from[i]>to[i])
            swap(from[i],to[i]);
        vec[from[i]].push_back(i);
        vec[to[i]].push_back(i);
    }
    dfs(0,0,-1);
    sort(ans.begin(),ans.end());
    for(pii u:ans)
        cout<<u.F<<" "<<u.S<<'\n';

}
### Prompt

Please provide a Cpp coded solution to the problem described below:

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 <iostream>
#include <vector>
#include <algorithm>
#define pii pair<int,int>
#define S second
#define F first

using namespace std;
const int MAX_N = 1e5+10;
const int INF = 1e9+10;
int from[MAX_N],to[MAX_N],DP[MAX_N],depth[MAX_N];
vector <int> vec[MAX_N];
vector <pii> ans;
bool mark[MAX_N];
void dfs(int v,int cnt,int l){
    mark[v]=true;
    depth[v]=cnt;
    for(int en:vec[v]){
        if(en==l)
            continue;
        int u=to[en]^from[en]^v;
        if(mark[u])
            DP[v]=min(DP[v],depth[u]);
        else{
            dfs(u,cnt+1,en);
            DP[v]=min(DP[v],DP[u]);
        }
    }
    if(DP[v]>=depth[v]&&l!=-1)
        ans.push_back({from[l],to[l]});
}
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n,m;
    cin>>n>>m;
    if(n==1)
        return 0;
    fill(DP,DP+max(n,m),INF);
    for(int i=0;i<m;i++){
        cin>>from[i]>>to[i];
        if(from[i]>to[i])
            swap(from[i],to[i]);
        vec[from[i]].push_back(i);
        vec[to[i]].push_back(i);
    }
    dfs(0,0,-1);
    sort(ans.begin(),ans.end());
    for(pii u:ans)
        cout<<u.F<<" "<<u.S<<'\n';

}
```