#include <bits/stdc++.h>
using namespace std;
pair<int, int> much[301010];
vector<int> g[101010], nr[101010];
int din[101010], lvl[101010];
bitset<303030> ori, viz;
int ok = 1;
int N, M;
void df(int x, int nivel, int ante) {
  lvl[x] = nivel;
  din[x] = nivel;
  viz[x] = 1;
  for (int i = 0; i < g[x].size(); ++i) {
    if (!viz[g[x][i]]) {
      much[nr[x][i]].first = x;
      much[nr[x][i]].second = g[x][i];
      df(g[x][i], nivel + 1, x);
      din[x] = min(din[x], din[g[x][i]]);
      if (din[g[x][i]] > nivel) ok = 0;
    } else if (g[x][i] != ante) {
      din[x] = min(din[x], lvl[g[x][i]]);
      much[nr[x][i]].first = g[x][i];
      much[nr[x][i]].second = x;
    }
  }
}
using namespace std;
int main() {
  int x, y;
  scanf("%d%d", &N, &M);
  for (int i = 1; i <= M; ++i) {
    scanf("%d%d", &x, &y);
    g[x].push_back(y);
    g[y].push_back(x);
    nr[x].push_back(i);
    nr[y].push_back(i);
    much[i].first = x;
    much[i].second = y;
  }
  df(1, 1, -1);
  for (int i = 1; i <= N; ++i)
    if (!viz[i]) {
      printf("0\n");
      return 0;
    }
  if (ok == 0)
    printf("0\n");
  else
    for (int i = 1; i <= M; ++i) {
      printf("%d %d\n", much[i].first, much[i].second);
    }
  return 0;
}
