#include <bits/stdc++.h>
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
vector<int> g[100011];
vector<int> dp(100011), in(100011), pa(100011);
int tim;
void dfs(int u) {
  in[u] = ++tim;
  for (auto v : g[u]) {
    if (!in[v]) {
      pa[v] = u;
      dfs(v);
    }
  }
}
int go(int u) {
  for (auto v : g[u]) {
    if (pa[v] == u) {
      dp[u] += go(v);
    }
  }
  return dp[u];
}
int solve() {
  int n, i, j, k, m, x, y;
  cin >> n >> m;
  for (i = 0; i < m; ++i) {
    cin >> x >> y;
    g[x].push_back(y);
    g[y].push_back(x);
  }
  tim = 0;
  dfs(1);
  for (i = 1; i <= n; ++i) {
    for (auto v : g[i]) {
      if (pa[v] == i || pa[i] == v) continue;
      if (in[v] < in[i]) dp[i]++;
      if (in[v] > in[i]) dp[i]--;
    }
  }
  go(1);
  for (i = 2; i <= n; ++i)
    if (!dp[i]) {
      cout << "0\n";
      return 0;
      ;
    }
  for (i = 1; i <= n; ++i) {
    for (auto v : g[i]) {
      if (v < i) continue;
      if (pa[v] == i)
        cout << i << " " << v << "\n";
      else if (pa[i] == v)
        cout << v << " " << i << "\n";
      else {
        if (in[i] < in[v])
          cout << v << " " << i << "\n";
        else
          cout << i << " " << v << "\n";
      }
    }
  }
  return 0;
  ;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  t = 1;
  while (t--) {
    solve();
  }
  return 0;
  ;
}
