#include <bits/stdc++.h>
using namespace std;
long n, m, u, v, kt = 0, cnt = 0, check[100005];
long num[100005], low[100005];
vector<long> adj[100005];
vector<pair<long, long> > edge;
map<pair<long, long>, bool> dd;
void dfs(int u, int p) {
  check[u] = 1;
  num[u] = low[u] = cnt++;
  for (int v : adj[u]) {
    if (check[v] == 0) {
      edge.push_back(make_pair(u, v));
      dfs(v, u);
      low[u] = min(low[u], low[v]);
      if (low[v] > num[u]) {
        kt = 1;
        return;
      }
    } else {
      if (v != p && (dd[make_pair(u, v)] == 0 && dd[make_pair(v, u)] == 0)) {
        low[u] = min(low[u], num[v]);
        edge.push_back(make_pair(u, v));
        dd[make_pair(u, v)] = dd[make_pair(v, u)] = 1;
      }
    }
  }
}
int main() {
  scanf("%ld %ld", &n, &m);
  for (int i = 1; i <= m; i++) {
    scanf("%ld %ld", &u, &v);
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  dfs(1, 1);
  if (kt == 1) {
    cout << "0";
  } else {
    for (int i = 0; i < edge.size(); i++) {
      cout << edge[i].first << " " << edge[i].second << endl;
    }
  }
}
