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