#include <bits/stdc++.h>
using namespace std;
vector<pair<int, int>> p;
vector<int> adj[100001];
int vis[100001];
int tin[100001], low[100001];
int timer = 0;
int bridge = 0;
void dfs(int v, int par) {
  vis[v] = 1;
  tin[v] = low[v] = timer++;
  for (int child : adj[v]) {
    if (child == par) continue;
    if (vis[child] == 1) {
      low[v] = min(low[v], tin[child]);
      if (tin[child] < tin[v]) p.push_back({v, child});
    } else {
      dfs(child, v);
      if (low[child] > tin[v]) {
        bridge = 1;
        return;
      }
      low[v] = min(low[v], low[child]);
      p.push_back({v, child});
    }
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    int x, y;
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  dfs(1, -1);
  if (bridge)
    cout << "0";
  else
    for (pair<int, int> op : p) cout << op.first << " " << op.second << endl;
}
