#include <bits/stdc++.h>
using namespace std;
const long long maxn = 2e5 + 123;
vector<int> g[maxn];
bool used[maxn];
int timer;
int tin[maxn], fup[maxn];
vector<pair<int, int> > ans;
void dfs(int v, int p) {
  used[v] = 1;
  tin[v] = fup[v] = timer++;
  for (auto to : g[v]) {
    if (to == p) {
      continue;
    }
    if (used[to]) {
      fup[v] = min(fup[v], tin[to]);
      if (tin[to] < tin[v]) {
        ans.push_back({v, to});
      }
    } else {
      ans.push_back({v, to});
      dfs(to, v);
      fup[v] = min(fup[v], fup[to]);
      if (fup[to] > tin[v]) {
        cout << "0";
        exit(0);
      }
    }
  }
}
int main() {
  ios_base ::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs(1, -1);
  for (auto i : ans) {
    cout << i.first << " " << i.second << "\n";
  }
}
