#include <bits/stdc++.h>
using namespace std;
vector<int> adj[100005];
int visi[100005];
int in[100005], low[100005];
int timer;
bool flag;
vector<pair<int, int>> edges;
void isBridge(int s, int p) {
  visi[s] = 1;
  in[s] = low[s] = timer++;
  for (int v : adj[s]) {
    if (!visi[v]) {
      isBridge(v, s);
      if (low[v] > in[s]) {
        flag = true;
        return;
      }
      low[s] = min(low[s], low[v]);
      edges.push_back({s, v});
    } else if (v != p) {
      low[s] = min(low[s], in[v]);
      if (in[v] < in[s]) edges.push_back({s, v});
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL);
  int n, m, x, y;
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> x >> y;
    adj[x].push_back(y), adj[y].push_back(x);
  }
  isBridge(1, -1);
  if (flag)
    cout << 0 << "\n";
  else
    for (auto it : edges) cout << it.first << " " << it.second << "\n";
}
