#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 4;
int n, m, cnt, low[N], num[N];
vector<pair<int, int> > vec;
vector<int> adj[N];
map<pair<int, int>, int> ma;
void dfs(int u, int p) {
  cnt++;
  low[u] = num[u] = cnt;
  for (auto v : adj[u]) {
    if (v != p) {
      if (num[v]) {
        int u1 = u;
        int v1 = v;
        if (u1 > v1) swap(u1, v1);
        low[u] = min(low[u], num[v]);
        if (ma[make_pair(u1, v1)] == 0) {
          vec.push_back(make_pair(u, v));
          ma[make_pair(u1, v1)] = 1;
        }
      } else {
        vec.push_back(make_pair(u, v));
        dfs(v, u);
        low[u] = min(low[u], low[v]);
        if (low[v] >= num[v]) {
          cout << 0;
          exit(0);
        }
      }
    }
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  dfs(1, 1);
  cout << '\n';
  for (auto v : vec) cout << v.first << " " << v.second << '\n';
}
