#include <bits/stdc++.h>
using namespace std;
const double EPS = 1e-8;
const int INF = 0x3F3F3F3F;
const int64_t LINF = 4611686018427387903;
const int MOD = 1e9 + 7;
bool vis[100007];
int low[100007], tim[100007];
vector<vector<int>> edge;
vector<bool> tree;
vector<pair<int, int>> edges;
int cnt;
bool dfs(int now, int pa) {
  low[now] = tim[now] = ++cnt;
  vis[now] = 1;
  bool res = true;
  for (auto &x : edge[now]) {
    int a = edges[x].first, b = edges[x].second;
    if (b == now) swap(a, b);
    if (b == pa) continue;
    if (vis[b])
      low[now] = min(low[now], tim[b]);
    else {
      res &= dfs(b, now);
      if (low[b] > tim[now]) res = false;
      low[now] = min(low[now], low[b]);
      tree[x] = true;
    }
  }
  if (now == pa) res &= (edge[now].size() > 1);
  return res;
}
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  edge.resize(n + 1);
  edges.resize(m);
  tree.resize(m);
  for (int i = 0, a, b; i < m; i++)
    cin >> a >> b, edge[a].push_back(i), edge[b].push_back(i),
        edges[i] = {a, b};
  bool can = dfs(1, 1);
  if (can) {
    for (int i = 0; i < m; i++) {
      if (tree[i] && (tim[edges[i].first] > tim[edges[i].second]))
        swap(edges[i].first, edges[i].second);
      if (!tree[i] && (tim[edges[i].first] < tim[edges[i].second]))
        swap(edges[i].first, edges[i].second);
      cout << edges[i].first << ' ' << edges[i].second << '\n';
    }
  } else {
    cout << "0\n";
  }
  return 0;
}
