#include <bits/stdc++.h>
using namespace std;
const int N = 100000 + 123;
const int M = 300000 + 123;
vector<pair<int, int> > g[N];
pair<int, int> ans[M];
int dp[N];
int ti;
int mt[N];
bool visited[N];
int n, m;
bool havesol = true;
void dfs(int p, int f) {
  if (!havesol) return;
  mt[p] = dp[p] = ti++;
  for (int i = 0; i < g[p].size(); ++i) {
    int t = g[p][i].first;
    int id = g[p][i].second;
    if (mt[t] == 0) {
      ans[id] = make_pair(p, t);
      dfs(t, p);
      dp[p] = min(dp[p], dp[t]);
    } else if (t != f) {
      if (!visited[t]) ans[id] = make_pair(p, t);
      dp[p] = min(dp[p], mt[t]);
    }
  }
  visited[p] = true;
  if (dp[p] >= mt[p] && f) havesol = false;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    g[a].push_back(make_pair(b, i));
    g[b].push_back(make_pair(a, i));
  }
  ti = 1;
  memset(dp, 0, sizeof(dp));
  memset(mt, 0, sizeof(mt));
  memset(visited, 0, sizeof(visited));
  dfs(1, 0);
  if (!havesol)
    puts("0");
  else {
    for (int i = 0; i < m; ++i) printf("%d %d\n", ans[i].first, ans[i].second);
  }
  return 0;
}
