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


struct LowLink {
    int n, pos;
    vector<vector<int>> G;
    vector<int> ord, low, par, ap;
    vector<pair<int, int>> brg;
    LowLink(int n) : n(n), pos(0), G(n), ord(n, -1), low(n), par(n, -1){}
    void addEdge(int u, int v){
        G[u].push_back(v);
        G[v].push_back(u);
    }
    void dfs(int v){
        ord[v] = low[v] = pos++;
        int dup = 0;
        for(int u : G[v]){
            if(u == par[v]){
                if(dup) low[v] = min(low[v], ord[u]);
                dup = 1;
                continue;
            }
            if(~ord[u]){
                low[v] = min(low[v], ord[u]);
                continue;
            }
            par[u] = v;
            dfs(u);
            low[v] = min(low[v], low[u]);
            if(ord[v] < low[u]) brg.emplace_back(minmax(u, v));
        }
    }
    void build(){
        for(int i = 0;i < n;++i) if(ord[i] < 0) dfs(i);
        vector<int > cnt(n, 0);
        for(int i = 0;i < n;++i){
            int p = par[i];
            if(p < 0) continue;
            if(par[p] < 0) cnt[p]++;
            else if(ord[p] <= low[i]) ap.push_back(p);
        }
        for(int i = 0;i < n;++i) if(cnt[i] > 1) ap.push_back(i);
        sort(begin(ap), end(ap));
        sort(begin(brg), end(brg));
        ap.erase(unique(begin(ap), end(ap)), end(ap));
    }
    bool isBridge(int u, int v){
        if(ord[u] > ord[v]) swap(u, v);
        return ord[u] < low[v];
    }
};


int V, E;


int main(){
    cin >> V >> E;
    LowLink G(V);
    for(int i = 0;i < E;++i){
        int s, t;
        cin >> s >> t;
        G.addEdge(s, t);
    }
    G.build();
    for(auto p : G.brg) cout << p.first << ' ' << p.second << endl;
    return 0;
}
