#include <bits/stdc++.h>
using namespace std;
vector<int> g[100001];
int vis[100001], low[100001], in[100001], timer;
vector<pair<int, int>> ans;
bool bridge;
void dfs(int node, int parent) {
  vis[node] = 1;
  in[node] = low[node] = timer++;
  for (int x : g[node]) {
    if (x == parent)
      continue;
    else if (vis[x] == 1) {
      low[node] = min(low[node], in[x]);
      if (in[x] < in[node]) ans.push_back({node, x});
    } else {
      dfs(x, node);
      if (low[x] > in[node]) {
        bridge = true;
        return;
      }
      low[node] = min(low[node], low[x]);
      ans.push_back({node, x});
    }
  }
}
int main() {
  long long m, n, a, b;
  cin >> n >> m;
  while (m--) {
    cin >> a >> b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  dfs(1, -1);
  if (bridge)
    cout << 0 << "\n";
  else {
    for (pair<int, int> p : ans) {
      cout << p.first << " " << p.second << "\n";
    }
  }
  return 0;
}
