#include <bits/stdc++.h>
using namespace std;
const long long N = 1e5 + 5;
vector<long long> v[N];
bool vis[N];
long long dep[N];
vector<pair<long long, long long> > ans;
long long dfs(long long z, long long p = 0) {
  vis[z] = 1;
  dep[z] = p ? dep[p] + 1 : 0;
  long long l = dep[z];
  for (long long x : v[z]) {
    if (x == p) continue;
    if (vis[x]) {
      if (dep[x] < dep[z]) {
        l = min(l, dep[x]);
        ans.push_back({z, x});
      }
      continue;
    }
    l = min(l, dfs(x, z));
    ans.push_back({z, x});
  }
  if (dep[z] && l == dep[z]) {
    cout << 0;
    exit(0);
  }
  return l;
}
void test_case() {
  long long n, m;
  cin >> n >> m;
  while (m--) {
    long long x, y;
    cin >> x >> y;
    v[x].push_back(y);
    v[y].push_back(x);
  }
  dfs(1);
  for (auto x : ans) {
    cout << x.first << ' ' << x.second << "\n";
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long t = 1;
  for (long long i = 0; i < t; i++) {
    test_case();
  }
  return 0;
}
