#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 100;
vector<int> adj[maxn];
bool mark[maxn], cut = false;
int d[maxn], par[maxn], minn[maxn];
vector<pair<int, int> > ans;
void dfs(int v) {
  mark[v] = true;
  minn[v] = d[v];
  for (int i = 0; i < adj[v].size(); i++) {
    int u = adj[v][i];
    if (mark[u] && u != par[v] && d[u] < d[v]) {
      minn[v] = min(minn[v], d[u]);
      ans.push_back(make_pair(v, u));
    } else if (!mark[u]) {
      par[u] = v;
      d[u] = d[v] + 1;
      dfs(u);
      ans.push_back(make_pair(v, u));
      minn[v] = min(minn[v], minn[u]);
      if (minn[u] >= d[u]) cut = true;
    }
  }
}
int main() {
  int n, m;
  ios::sync_with_stdio(false);
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    int u, v;
    cin >> u >> v;
    u--, v--;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  par[0] = -1;
  dfs(0);
  if (cut) {
    cout << "0" << endl;
    return 0;
  }
  for (int i = 0; i < ans.size(); i++)
    cout << ans[i].first + 1 << " " << ans[i].second + 1 << "\n";
  return 0;
}
