#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
const int M = 5e5 + 5;
const int OO = 1e9;
const int mod = 1e9 + 7;
int n, m, low[N], rnk[N], ok = 1, vis[N], nodes, comp;
vector<int> g[N];
vector<pair<int, int> > ans;
void dfs(int u, int p) {
  if (vis[u]) return;
  vis[u] = 1;
  rnk[u] = low[u] = ++nodes;
  for (auto v : g[u]) {
    if (v == p) continue;
    bool visited = vis[v];
    if (!visited)
      ans.push_back({u, v});
    else if (rnk[v] > rnk[u])
      ans.emplace_back(v, u);
    dfs(v, u);
    low[u] = min(low[u], visited ? rnk[v] : low[v]);
  }
  if (low[u] == rnk[u]) ++comp;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  while (m--) {
    int u, v;
    cin >> u >> v;
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs(1, 1);
  if (comp == 1) {
    for (auto i : ans) cout << i.first << ' ' << i.second << '\n';
  } else
    cout << "0\n";
  return 0;
}
