#include <bits/stdc++.h>
using namespace std;
vector<int> adj[1000001];
int vis[1000001];
vector<pair<int, int>> v;
int in[1000001], low[1000001];
int timer = 0, f = 0;
void dfs(int i, int par) {
  vis[i] = 1;
  in[i] = low[i] = timer;
  timer++;
  for (auto x : adj[i]) {
    if (x == par) {
      continue;
    }
    if (vis[x] == 1) {
      low[i] = min(low[i], in[x]);
      if (in[i] > in[x]) {
        v.push_back(make_pair(i, x));
      }
    } else {
      dfs(x, i);
      if (low[x] > in[i]) {
        f = 1;
        return;
      }
      v.push_back(make_pair(i, x));
      low[i] = min(low[i], low[x]);
    }
  }
}
void initialize() {
  for (int i = 0; i < 1000001; i++) {
    vis[i] = 0;
  }
}
int main() {
  int t = 1;
  while (t--) {
    int n, m;
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
      int a, b;
      cin >> a >> b;
      adj[a].push_back(b);
      adj[b].push_back(a);
    }
    initialize();
    dfs(1, -1);
    if (f == 1) {
      cout << "0"
           << "\n";
    } else {
      for (int i = 0; i < v.size(); i++) {
        cout << v[i].first << " " << v[i].second << "\n";
      }
    }
  }
}
