#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9;
const long long INFLL = 2e18;
const int MOD = 1e8 + 7;
const int N = 4e5 + 10;
int fx[8] = {+0, +0, +1, -1, +1, +1, -1, -1};
int fy[8] = {+1, -1, +0, +0, +1, -1, +1, -1};
int timer;
int used[N];
int tin[N], low[N];
char bridge;
vector<int> g[N];
void dfsAP(int v, int p = -1) {
  if (bridge) return;
  used[v] = 1;
  tin[v] = low[v] = ++timer;
  for (int to : g[v]) {
    if (p == to) continue;
    if (!used[to]) {
      dfsAP(to, v);
      low[v] = min(low[v], low[to]);
      if (tin[v] < low[to]) bridge = 1;
    } else {
      low[v] = min(low[v], tin[to]);
    }
  }
  used[v] = 2;
}
void dfsCC(int v, int p = -1) {
  used[v] = 1;
  for (int to : g[v]) {
    if (p == to) continue;
    if (!used[to]) {
      dfsCC(to, v);
      printf("%d %d\n", v, to);
    } else if (used[to] == 1) {
      printf("%d %d\n", v, to);
    }
  }
  used[v] = 2;
}
void solve(int n) {
  dfsAP(1);
  if (bridge) {
    puts("0");
    return;
  }
  fill(used, used + n + 1, 0);
  dfsCC(1);
}
int main() {
  int n, m, u, v;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; ++i) {
    scanf("%d %d", &u, &v);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  solve(n);
}
