#include <bits/stdc++.h>
using namespace std;
long long n, k, timer = 0;
vector<long long> v, in, out;
vector<pair<long long, long long>> ans;
vector<vector<long long>> graph;
vector<bool> visited;
void dfs(long long i, long long par) {
  in[i] = timer;
  out[i] = timer;
  timer += 1;
  visited[i] = true;
  for (auto j : graph[i]) {
    if (j == par) continue;
    if (visited[j]) {
      out[i] = min(out[i], in[j]);
      if (in[i] > in[j]) ans.push_back(make_pair(i, j));
    } else {
      dfs(j, i);
      if (in[i] < out[j]) {
        cout << 0;
        exit(0);
      }
      out[i] = min(out[i], out[j]);
      ans.push_back(make_pair(i, j));
    }
  }
}
void solve() {
  cin >> n >> k;
  graph.resize(n + 1);
  visited.resize(n + 1, false);
  in.resize(n + 1);
  out.resize(n + 1);
  for (long long i = 0; i < k; i++) {
    long long x, y;
    cin >> x >> y;
    graph[x].push_back(y);
    graph[y].push_back(x);
  }
  dfs(1, -1);
  for (auto i : ans) {
    cout << i.first << " " << i.second << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long q = 1;
  while (q--) {
    v.clear();
    solve();
  }
}
