#include <bits/stdc++.h>
using namespace std;
const int Nmax = 2e5;
vector<int> adj[Nmax];
int vis[Nmax], in[Nmax], low[Nmax], timer;
vector<pair<int, int>> edgeList;
bool hasBridge;
void dfs(int node, int par) {
  vis[node] = 1;
  in[node] = low[node] = timer++;
  for (int child : adj[node]) {
    if (child == par) continue;
    if (vis[child] == 1) {
      low[node] = min(low[node], in[child]);
      if (in[node] > in[child]) edgeList.push_back({node, child});
    } else {
      dfs(child, node);
      if (low[child] > in[node]) {
        hasBridge = true;
        return;
      }
      edgeList.push_back({node, child});
      low[node] = min(low[node], low[child]);
    }
  }
}
int main() {
  int n, m, u, v;
  cin >> n >> m;
  while (m--) {
    cin >> u >> v;
    adj[u].push_back(v), adj[v].push_back(u);
  }
  dfs(1, -1);
  if (hasBridge) {
    cout << "0"
         << "\n";
  } else {
    for (pair<int, int> i : edgeList)
      cout << i.first << " " << i.second << "\n";
  }
  return 0;
}
