#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void Int(T &n) {
  n = 0;
  int f = 1;
  int ch = getchar();
  for (; !isdigit(ch); ch = getchar())
    if (ch == '-') f = -1;
  for (; isdigit(ch); ch = getchar()) n = (n << 3) + (n << 1) + ch - '0';
  n = n * f;
}
template <typename T>
T gcd(T a, T b) {
  return !b ? a : gcd(b, a % b);
}
template <typename T>
inline void umin(T &a, T b) {
  a = a < b ? a : b;
}
template <typename T>
inline void umax(T &a, T b) {
  a = a > b ? a : b;
}
template <typename T, typename W>
inline void Int(T &x, W &y) {
  Int(x), Int(y);
}
template <typename T, typename W, typename Q>
inline void Int(T &x, W &y, Q &z) {
  Int(x, y), Int(z);
}
const int N = 1e5 + 7;
const int inf = 1e9 + 7;
int dp[N];
int lev[N];
vector<int> g[N];
vector<pair<int, int>> edges;
int dfs(int u, int p = -1) {
  dp[u] = 0;
  for (int v : g[u]) {
    if (lev[v] == 0) {
      lev[v] = lev[u] + 1;
      edges.push_back({u, v});
      dp[u] += dfs(v, u);
    } else if (lev[u] > lev[v] && v != p) {
      ++dp[u];
      --dp[v];
      edges.push_back({u, v});
    }
  }
  if (p != -1 && dp[u] == 0) {
    printf("0\n");
    exit(0);
  }
  return dp[u];
}
int solve() {
  int n, m;
  Int(n, m);
  for (int i = 1; i <= m; ++i) {
    int u, v;
    Int(u, v);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  for (int i = 1; i <= n; ++i) {
    if (!lev[i]) {
      lev[i] = 1;
      dfs(i);
    }
  }
  for (auto [u, v] : edges) {
    printf("%d %d\n", u, v);
  }
  return 0;
}
int main() {
  int tests = 1, CaseNo = 0;
  while (tests--) {
    solve();
  }
  return 0;
}
