#include <bits/stdc++.h>
using namespace std;
int n, m, ed, x, y, v[100005], l[100005], u[100005 * 6], qd[100005 * 6],
    qn[100005 * 6], cnt;
void bd(int x, int y) { qd[++ed] = y, qn[ed] = l[x], l[x] = ed; }
void dfs(int x) {
  v[x] = 1;
  for (int i = l[x]; i; i = qn[i]) {
    if (u[i]) continue;
    u[i] = 1;
    u[i ^ 1] = -1;
    if (!v[qd[i]]) dfs(qd[i]);
  }
}
void dfr(int x) {
  v[x] = 1;
  cnt++;
  for (int i = l[x]; i; i = qn[i]) {
    if (u[i] == -1 && !v[qd[i]]) dfr(qd[i]);
  }
}
int main() {
  scanf("%d%d", &n, &m);
  ed = 1;
  while (m--) scanf("%d%d", &x, &y), bd(x, y), bd(y, x);
  dfs(1);
  memset(v, 0, sizeof(v));
  dfr(1);
  if (cnt < n)
    printf("0");
  else {
    for (int i = 1; i <= n; i++) {
      for (int j = l[i]; j; j = qn[j]) {
        if (u[j] == 1) printf("%d %d\n", i, qd[j]);
      }
    }
  }
  return 0;
}
