#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 7;
void solve() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> g(n + 1);
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    g[u].emplace_back(v);
    g[v].emplace_back(u);
  }
  set<pair<int, int>> edges;
  vector<bool> visited(n + 1, false);
  vector<int> dp(n + 1, 0);
  vector<int> depth(n + 1, 0);
  vector<int> downward(n + 1, 0);
  vector<int> upward(n + 1, 0);
  function<void(int, int, int)> dfs = [&](int ver, int height, int par) {
    depth[ver] = height;
    visited[ver] = 1;
    int fromchildren = 0;
    for (auto child : g[ver]) {
      if (child == par) continue;
      if (visited[child]) {
        if (depth[child] > depth[ver]) {
          downward[ver]++;
        } else {
          upward[ver]++;
          edges.insert(make_pair(ver, child));
        }
        continue;
      }
      edges.insert(make_pair(ver, child));
      dfs(child, height + 1, ver);
      fromchildren += dp[child];
    }
    dp[ver] = upward[ver] - downward[ver] + fromchildren;
  };
  dfs(1, 0, -1);
  bool nobridges = true;
  for (int i = 2; i <= n; i++) {
    if (dp[i] == 0) nobridges = false;
  }
  if (!nobridges) {
    cout << 0 << endl;
    return;
  }
  for (auto ele : edges) {
    cout << ele.first << " " << ele.second << endl;
  }
}
int main() {
  ios ::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int tt = 1;
  for (int tc = 1; tc <= tt; tc++) {
    solve();
  }
}
