#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 1e5 + 5;
const long long MAXM = 3e5 + 5;
vector<pair<long long, long long> > edg[MAXN];
long long d[MAXN];
long long fup[MAXN];
bool OK = true;
bool used[MAXN];
bool used2[MAXN];
bool usedans[MAXM];
vector<pair<long long, long long> > ans;
void dfs(long long v, long long p) {
  used[v] = true;
  d[v] = d[p] + 1;
  fup[v] = d[v];
  for (auto pa : edg[v]) {
    long long u = pa.first;
    if (used[u]) {
      if (u != p) fup[v] = min(fup[v], d[u]);
      continue;
    }
    dfs(u, v);
    if (fup[u] > d[v]) OK = false;
    fup[v] = min(fup[v], fup[u]);
  }
}
void dfs2(long long v, long long p) {
  if (used2[v]) return;
  used2[v] = true;
  for (auto pa : edg[v]) {
    long long u = pa.first;
    if (u != p) {
      if (!usedans[pa.second]) {
        ans.push_back({v, u});
        usedans[pa.second] = true;
      }
      dfs2(u, v);
    }
  }
}
void fast() {
  ios::sync_with_stdio(0);
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
signed main() {
  fast();
  long long n, m, a, b, i;
  cin >> n >> m;
  for (i = 0; i < m; i++) {
    cin >> a >> b;
    edg[a].push_back({b, i});
    edg[b].push_back({a, i});
  }
  d[0] = 0;
  dfs(1, 0);
  if (OK == false) {
    cout << 0 << '\n';
    return 0;
  }
  dfs2(1, 0);
  for (auto c : ans) cout << c.first << " " << c.second << '\n';
}
