#include <bits/stdc++.h>
using namespace std;

int V, E;

void dfs(vector<vector<int>> &G, int p, int u, int d, vector<int> &depth, vector<int> &lowlink, vector<bool> &visited){
    visited[u] = true;
    depth[u] = lowlink[u] = d;
    
    for(auto v: G[u]) if(v != p){
        if(!visited[v]){
            dfs(G, u, v, d+1, depth, lowlink, visited);
            lowlink[u] = min(lowlink[u], lowlink[v]);
        }else{
            lowlink[u] = min(lowlink[u], depth[v]);
        }
    }
}

int main(){
    cin >> V >> E;
    
    vector<vector<int>> G(V);
    for(int i=0; i<E; i++){
        int s, t; cin >> s >> t;
        G[s].push_back(t);
        G[t].push_back(s);
    }
    for(int i=0; i<V; i++)
        sort(G[i].begin(), G[i].end());
    
    vector<int> depth(V, -1), lowlink(V, -1);
    vector<bool> visited(V, false);
    dfs(G, -1, 0, 0, depth, lowlink, visited);
    
    for(int s=0; s<V; s++){
        for(auto t: G[s]) if(s<t && (depth[s]<lowlink[t]||depth[t]<lowlink[s])){
            cout << s << " " << t << endl;
        }
    }
    
    return 0;
}