#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
vector<int> graph[MAXN];
int marc[MAXN];
int low[MAXN];
int pre[MAXN];
int pai[MAXN];
int dfs_time;
set<pair<int, int>> ans;
void dfs(int u) {
  marc[u] = 1;
  pre[u] = dfs_time;
  ++dfs_time;
  low[u] = 1e9;
  for (int v : graph[u]) {
    if (v == pai[u]) continue;
    if (marc[v]) {
      if (pre[u] > pre[v])
        ans.insert({u, v});
      else
        ans.insert({v, u});
      low[u] = min(low[u], pre[v]);
    } else {
      ans.insert({u, v});
      pai[v] = u;
      dfs(v);
      low[u] = min(low[u], low[v]);
    }
  }
}
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; ++i) {
    int u, v;
    scanf("%d%d", &u, &v);
    graph[u].push_back(v);
    graph[v].push_back(u);
  }
  dfs(1);
  for (int u = 1; u <= n; ++u)
    for (int v : graph[u]) {
      if (pai[u] != v && pai[v] != u) continue;
      int p = v;
      int f = u;
      if (pai[p] == f) swap(p, f);
      if (low[f] > pre[p]) {
        printf("0\n", f, p);
        return 0;
      }
    }
  for (auto [u, v] : ans) printf("%d %d\n", u, v);
}
