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>
#define pb push_back
#define mp make_pair

using namespace std;
typedef pair<int,int> pii;

const int maxn = 110000;

int n, m, a, b;
vector <int> adj[maxn];
vector <pii> cut;

bool mark[maxn];
int dp[maxn], h[maxn], par[maxn];
void dfs(int v)
{
    mark[v]=1;
    dp[v] = -1;
    int t = max(0, h[v]-1);
    for(auto u : adj[v])
    {
        if(!mark[u])
        {
            par[u] = v, h[u] = h[v]+1, dfs(u);
            dp[v] = (dp[v]==-1 ? dp[u] : min(dp[v], dp[u]));
        }
        else
        {
            t = min(t, h[u]);
        }
    }

    if((dp[v] >= h[v] || dp[v] == -1) && t == h[v]-1)
        cut.pb(mp(min(par[v],v), max(par[v],v)));
    dp[v] = min((dp[v]==-1 ? t : dp[v]), t);
}

int main()
{
    cin >> n >> m;
    for(int i = 0; i < m && cin>>a>>b; i ++)
        adj[a].pb(b), adj[b].pb(a);

    dfs(0);

    //for(int i = 0; i < n; i++)  cout << i << " : " << dp[i] << " , " << h[i]  << " , "  << par[i] << endl;

    sort(cut.begin(), cut.end(), [](pii a, pii b){return a.first == b.first ? a.second < b.second : a.first < b.first;});
    for(auto e : cut)
        cout << e.first << ' ' << e.second << endl;
    return 0;
}