#include <bits/stdc++.h>
using namespace std;
vector<int> v[100009];
vector<pair<int, int>> lis;
int vis[100009], in[100009], low[100009];
bool chk = false;
int tim;
void dfs(int node, int par) {
  vis[node] = 1;
  in[node] = low[node] = tim++;
  for (int child : v[node]) {
    if (child == par) continue;
    if (vis[child]) {
      low[node] = min(low[node], in[child]);
      if (in[child] < in[node]) lis.push_back({node, child});
    } else {
      dfs(child, node);
      if (low[child] > in[node]) {
        chk = true;
        return;
      }
      lis.push_back({node, child});
      low[node] = min(low[node], low[child]);
    }
  }
}
int main() {
  int n, m, a, b;
  cin >> n >> m;
  while (m--) cin >> a >> b, v[a].push_back(b), v[b].push_back(a);
  dfs(1, -1);
  if (chk == true) {
    cout << 0 << endl;
  } else {
    for (pair<int, int> k : lis) cout << k.first << " " << k.second << endl;
  }
}
