#include <bits/stdc++.h>
using namespace std;
vector<long long> adj[100003];
long long visited[100003];
long long in[100003];
long long low[100003];
long long timer;
bool ans = true;
void dfs(long long v, long long parent) {
  visited[v] = 1;
  in[v] = low[v] = timer;
  timer++;
  for (auto it : adj[v]) {
    if (it == parent) continue;
    if (visited[it] == 1)
      low[v] = min(low[v], in[it]);
    else {
      dfs(it, v);
      if (in[v] < low[it])
        ans = false;
      else
        low[v] = min(low[v], low[it]);
    }
  }
}
set<pair<long long, long long> > s;
void orientation(long long v, long long parent) {
  visited[v] = 1;
  for (auto it : adj[v]) {
    if (it == parent) continue;
    pair<long long, long long> p1, p2;
    p1 = {v, it};
    p2 = {it, v};
    if (s.find(p1) == s.end() && s.find(p2) == s.end())
      s.insert(p1), cout << v << " " << it << "\n";
    if (visited[it] == 0) orientation(it, v);
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, m, u, v;
  cin >> n >> m;
  for (auto i = 0; i < m; i += 1)
    cin >> u >> v, adj[u].push_back(v), adj[v].push_back(u);
  dfs(1, -1);
  if (ans) {
    memset(visited, 0, sizeof(visited));
    orientation(1, -1);
  } else {
    cout << "0";
  }
  return 0;
}
