#include <bits/stdc++.h>
using namespace std;
const int nax = 1e5 + 1;
vector<int> adj[nax];
bool visited[nax];
vector<pair<int, int>> ans;
int in[nax];
int low[nax];
int timer;
bool hasBridge = false;
void dfs(int node, int parent) {
  visited[node] = true;
  in[node] = low[node] = timer++;
  for (auto child : adj[node]) {
    if (child == parent) continue;
    if (!visited[child]) {
      ans.emplace_back(node, child);
      in[child] = timer++;
      dfs(child, node);
      if (low[child] > in[node]) {
        hasBridge = true;
        return;
      }
      low[node] = min(low[node], low[child]);
    } else {
      low[node] = min(low[node], in[child]);
      if (in[node] > in[child]) ans.emplace_back(node, child);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m;
  cin >> n >> m;
  while (m--) {
    int a, b;
    cin >> a >> b;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  dfs(1, -1);
  if (hasBridge) {
    cout << 0 << "\n";
  } else {
    for (auto x : ans) {
      cout << x.first << " " << x.second << "\n";
    }
  }
  return 0;
}
