#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 2e5 + 5;
const int M = 3 * N;
struct edge {
  int to, next;
} e[M];
int head[N], tot = 1;
int n, m, mark[M];
ll dp[N], lv[N];
bool vis[N];
void add(int x, int y) {
  e[++tot] = {y, head[x]};
  head[x] = tot;
}
inline void dfs(int x, int fa) {
  dp[x] = 0;
  for (int i = head[x]; i; i = e[i].next) {
    int nv = e[i].to;
    if (!lv[nv]) {
      if (!mark[i ^ 1]) mark[i] = 1;
      lv[nv] = lv[x] + 1;
      dfs(nv, x);
      dp[x] += dp[nv];
    } else if (lv[nv] < lv[x]) {
      if (!mark[i ^ 1]) mark[i] = 1;
      dp[x] += 1;
    } else if (lv[nv] > lv[x]) {
      if (!mark[i ^ 1]) mark[i] = 1;
      dp[x] -= 1;
    }
  }
  dp[x]--;
}
inline void report() {
  for (int v = 1; v <= n; ++v) {
    for (int i = head[v]; i; i = e[i].next) {
      if (mark[i]) {
        cout << v << " " << e[i].to << endl;
      }
    }
  }
}
int main() {
  cin >> n >> m;
  int a, b;
  for (int i = 1; i <= m; ++i) {
    cin >> a >> b;
    add(a, b);
    add(b, a);
  }
  tot = 1;
  lv[1] = 1;
  dfs(1, 0);
  for (int i = 2; i <= n; ++i) {
    if (dp[i] == 0) {
      cout << 0 << endl;
      return 0;
    }
  }
  report();
}
