// #define DEBUGGING
#include <bits/stdc++.h>
#define endl '\n'
#define ALL(V) (V).begin(), (V).end()
#define ALLR(V) (V).rbegin(), (V).rend()
using ll = std::int64_t;
using ull = std::uint64_t;
using PLL = std::pair<ll, ll>;
using TLL = std::tuple<ll, ll, ll>;
template <typename T> using V = std::vector<T>;
template <typename T> using VV = V<V<T>>;
template <typename T> const T& var_min(const T &t) { return t; }
template <typename T> const T& var_max(const T &t) { return t; }
template <typename T, typename... Tail> const T& var_min(const T &t, const Tail&... tail) { return std::min(t, var_min(tail...)); }
template <typename T, typename... Tail> const T& var_max(const T &t, const Tail&... tail) { return std::max(t, var_max(tail...)); }
template <typename T, typename... Tail> void chmin(T &t, const Tail&... tail) { t = var_min(t, tail...); }
template <typename T, typename... Tail> void chmax(T &t, const Tail&... tail) { t = var_max(t, tail...); }
template <typename T> const T& clamp(const T &t, const T &low, const T &high) { return std::max(low, std::min(high, t)); }
template <typename T> void chclamp(T &t, const T &low, const T &high) { return t = clamp(t, low, high); }
namespace init__ { struct InitIO { InitIO() { std::cin.tie(nullptr); std::ios_base::sync_with_stdio(false); std::cout << std::fixed << std::setprecision(30); } } init_io; }
#define mv_rec make_v(init, tail...)
template <typename T> T make_v(T init) { return init; }
template <typename T, typename... Tail> auto make_v(T init, size_t s, Tail... tail) { return V<decltype(mv_rec)>(s, mv_rec); }
#undef mv_rec
using namespace std;

#ifdef DEBUGGING
#include "../../debug/debug.cpp"
#else
#define DEBUG(...) 0
#define DEBUG_SEPARATOR_LINE 0
#endif

struct LowLink {
    ll N;
    const VV<ll> &edges;
    V<ll> low, ord;
    V<bool> visited;
    V<bool> is_articulation;
    ll dfs_counter;

    LowLink(const VV<ll> &edges)
        : N(edges.size()), edges(edges), low(edges.size()), ord(edges.size()), 
          visited(edges.size()), is_articulation(edges.size()), dfs_counter(0)
    {
        for (ll i = 0; i < N; i++) if (!visited[i]) dfs(i, -1);
    }

    void dfs(ll cur, ll pre) {
        visited[cur] = true;
        ord[cur] = dfs_counter++;
        low[cur] = ord[cur];
        ll children = 0;
        bool art = false;
        for (ll nxt : edges[cur]) {
            if (!visited[nxt]) {
                children++;
                dfs(nxt, cur);
                chmin(low[cur], low[nxt]);
                art |= (pre == -1 ? 2 <= children : ord[cur] <= low[nxt]);
            } else if (nxt != pre) {
                chmin(low[cur], ord[nxt]);
            }
        }
        is_articulation[cur] = art;
    }

    bool is_art(ll cur) { return is_articulation[cur]; }

    // u -> v
    bool is_bridge(ll from, ll to) { return ord[from] < low[to]; }

    V<PLL> enum_bridges() {
        V<PLL> ret;
        for (ll from = 0; from < N; from++) {
            for (ll to : edges[from]) {
                if (!(from < to)) continue;
                if (is_bridge(from, to)) ret.emplace_back(from, to);
            }
        }
        return ret;
    }
};

int main() {
    ll N, M;
    cin >> N >> M;
    VV<ll> edges(N);
    for (ll i = 0; i < M; i++) {
        ll a, b;
        cin >> a >> b;
        edges[a].push_back(b);
        edges[b].push_back(a);
    }

    for (auto &&v : edges) sort(ALL(v));

    LowLink lowlink(edges);

    // for (ll i = 0; i < N; i++) if (lowlink.is_art(i)) cout << i << endl;
    for (ll i = 0; i < N; i++) for (ll j : edges[i]) {
        if (!(i < j)) continue;
        if (lowlink.is_bridge(i, j) || lowlink.is_bridge(j, i)) cout << i << ' ' << j << endl;
    }
    return 0;
}



Measured memory_bytes: 5292