#include <bits/stdc++.h>
using namespace std;
vector<long long int> a[100005];
long long int vis[100005];
long long int intime[100005], low[100005];
long long int timer;
bool hasBridge;
vector<pair<long long int, long long int>> edgeList;
void dfs(long long int node, long long int parent) {
  vis[node] = 1;
  intime[node] = low[node] = timer++;
  for (long long int child : a[node]) {
    if (child == parent) continue;
    if (vis[child]) {
      low[node] = min(low[node], intime[child]);
      if (intime[node] > intime[child]) edgeList.push_back({node, child});
    } else {
      dfs(child, node);
      if (low[child] > intime[node]) {
        hasBridge = true;
        return;
      }
      edgeList.push_back({node, child});
      low[node] = min(low[node], low[child]);
    }
  }
}
signed main() {
  long long int n, e;
  cin >> n >> e;
  for (long long int i = 0; i < e; i++) {
    long long int x, y;
    cin >> x >> y;
    a[x].push_back(y);
    a[y].push_back(x);
  }
  dfs(1, -1);
  if (hasBridge)
    cout << 0 << endl;
  else {
    for (auto i : edgeList) cout << i.first << " " << i.second << endl;
  }
}
