#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
class EBertownRoads {
  static const int MX = 200005;
  vector<int> adj[MX];
  int level[MX] = {0};
  int dp[MX] = {0};
  bool flag = true;
  vector<pair<int, int> > ans;

 public:
  void dfs(int src) {
    dp[src] = 0;
    for (int child : adj[src]) {
      if (level[child] == 0) {
        level[child] = level[src] + 1;
        dfs(child);
        dp[src] += dp[child];
        ans.emplace_back(src, child);
      } else if (level[child] > level[src]) {
        dp[src]--;
        ans.emplace_back(child, src);
      } else if (level[child] < level[src]) {
        dp[src]++;
      }
    }
    dp[src]--;
    if (level[src] > 1 && dp[src] == 0) {
      flag = false;
    }
  }
  void solve(std::istream& in, std::ostream& out) {
    int n, m;
    in >> n >> m;
    int from, to;
    for (int i = 0; i < m; i++) {
      in >> from >> to;
      adj[from].push_back(to);
      adj[to].push_back(from);
    }
    level[1] = 1;
    dfs(1);
    if (flag) {
      for (auto t : ans) {
        out << t.first << " " << t.second << "\n";
      }
    } else
      out << "0\n";
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  EBertownRoads solver;
  std::istream& in(std::cin);
  std::ostream& out(std::cout);
  solver.solve(in, out);
  return 0;
}
