#include <bits/stdc++.h>
using namespace std;
vector<int> ar[100001];
int vis[100001], in[100001], low[100001];
int timer;
int has_bridge;
vector<pair<int, int>> edge;
void dfs(int n, int par) {
  vis[n] = 1;
  in[n] = low[n] = timer++;
  for (int child : ar[n]) {
    if (child == par) continue;
    if (vis[child] == 1) {
      low[n] = min(low[n], in[child]);
      if (in[n] > in[child]) {
        edge.push_back({n, child});
      }
    } else {
      dfs(child, n);
      if (in[n] < low[child]) {
        has_bridge = true;
        return;
      }
      edge.push_back({n, child});
      low[n] = min(low[n], low[child]);
    }
  }
}
int main() {
  int n, m, a, b;
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    cin >> a >> b, ar[a].push_back(b), ar[b].push_back(a);
  }
  timer = 0;
  dfs(1, -1);
  if (has_bridge) {
    cout << 0 << endl;
  } else {
    for (pair<int, int> e : edge) {
      cout << e.first << " " << e.second << endl;
    }
  }
  return 0;
}
