#include <bits/stdc++.h>
const long long MOD = 1e9 + 7;
using namespace std;
long long timer = 0, checker = 0;
vector<long long> viz(200005, 0), g[200005], in(200005), low(200005);
vector<pair<long long, long long> > ans;
long long POWER(long long base, long long expo) {
  long long ret = 1;
  while (expo) {
    if (expo & 1) ret = ret * base;
    expo >>= 1;
    base = base * base;
  }
  return ret;
}
void dfs(long long node, long long par) {
  viz[node] = 1;
  in[node] = low[node] = timer;
  timer++;
  for (auto to : g[node]) {
    if (to == par) continue;
    if (viz[to]) {
      low[node] = min(low[node], in[to]);
      if (in[to] < in[node]) ans.push_back({node, to});
    } else {
      dfs(to, node);
      ans.push_back({node, to});
      if (low[to] > in[node]) {
        checker = 1;
      }
      low[node] = min(low[node], low[to]);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long test_case = 1;
  while (test_case--) {
    long long n, m;
    cin >> n >> m;
    for (long long i = 0; i < m; i++) {
      long long u, v;
      cin >> u >> v;
      g[u].push_back(v);
      g[v].push_back(u);
    }
    dfs(1, -1);
    if (checker) {
      cout << 0;
      return 0;
    }
    for (auto i : ans) cout << i.first << " " << i.second << endl;
  }
  return 0;
}
