/**
 * @title Template
 */

#include <iostream>
#include <algorithm>
#include <utility>
#include <numeric>
#include <vector>
#include <array>
#include <cassert>


template <class T, class U>
bool chmin(T &lhs, const U &rhs) {
  if (lhs > rhs) { 
    lhs = rhs; 
    return true; 
  }
  return false;
}

template <class T, class U>
bool chmax(T &lhs, const U &rhs) {
  if (lhs < rhs) { 
    lhs = rhs; 
    return true; 
  }
  return false;
}

/**
 * @title Chmin/Chmax
 */


class range {
public:
  class iterator {
  private:
    int64_t M_position;

  public:
    iterator(int64_t position) noexcept: M_position(position) { }
    void operator ++ () noexcept { ++M_position; }
    bool operator != (iterator other) const noexcept { return M_position != other.M_position; }
    int64_t operator * () const noexcept { return M_position; }

  };

  class reverse_iterator {
  private:
    int64_t M_position;
  
  public:
    reverse_iterator(int64_t position) noexcept: M_position(position) { }
    void operator ++ () noexcept { --M_position; }
    bool operator != (reverse_iterator other) const noexcept { return M_position != other.M_position; }
    int64_t operator * () const noexcept { return M_position; }

  };
  
private:
  const iterator M_first, M_last;

public:
  range(int64_t first, int64_t last) noexcept: M_first(first), M_last(std::max(first, last)) { }
  iterator begin() const noexcept { return M_first; }
  iterator end() const noexcept { return M_last; }
  reverse_iterator rbegin() const noexcept { return reverse_iterator(*M_last - 1); } 
  reverse_iterator rend() const noexcept { return reverse_iterator(*M_first - 1); } 

};

/**
 * @title Range
 */

#include <type_traits>
#include <iterator>

template <class T>
class rev_impl {
public:
  using iterator = decltype(std::declval<T>().rbegin());

private:
  const iterator M_begin;
  const iterator M_end;

public:
  rev_impl(T &&cont) noexcept: M_begin(cont.rbegin()), M_end(cont.rend()) { }
  iterator begin() const noexcept { return M_begin; }
  iterator end() const noexcept { return M_end; }

};

template <class T>
rev_impl<T> rev(T &&cont) {
  return rev_impl<T>(std::forward<T>(cont));
}

/**
 * @title Reverser
 */

using i32 = int32_t;
using i64 = int64_t;
using u32 = uint32_t;
using u64 = uint64_t;

constexpr i32 inf32 = (i32(1) << 30) - 1;
constexpr i64 inf64 = (i64(1) << 62) - 1;

constexpr size_t Vertices = 100000;

i32 V, E;
std::array<std::vector<i32>, Vertices> graph;
std::array<i32, Vertices> ord, low;
std::vector<std::pair<i32, i32>> ans;

i32 index;
void dfs(const i32 u, const i32 p) {
  ord[u] = low[u] = index;
  ++index;
  i32 cnt = 0;
  bool art = false;
  for (const auto v: graph[u]) {
    if (v == p) {
      continue;
    }
    if (ord[v] == -1) {
      dfs(v, u);
      chmin(low[u], low[v]);
      if (ord[u] < low[v]) {
        ans.push_back(std::minmax(u, v));
      }
      ++cnt;
    }
    else {
      chmin(low[u], ord[v]);
    }
  }
}

int main() {
  std::cin >> V >> E;
  ord.fill(-1);
  for (auto i: range(0, E)) {
    i32 s, t;
    std::cin >> s >> t;
    graph[s].push_back(t);
    graph[t].push_back(s);
  }
  dfs(0, -1);
  std::sort(ans.begin(), ans.end());
  for (auto p: ans) {
    std::cout << p.first << ' ' << p.second << '\n';
  }
  return 0;
}



Measured memory_bytes: 7512