#include <bits/stdc++.h>
using namespace std;
int timer{};
vector<long long> ar[1000001];
vector<long long> vis(1000001, 0), in(1000001, 0), low(1000001, 0);
vector<pair<long long, long long>> roadPair{};
bool dfs(long long node, long long par) {
  vis[node] = 1;
  in[node] = low[node] = timer;
  timer++;
  for (auto child : ar[node]) {
    if (child == par) continue;
    if (vis[child]) {
      low[node] = min(low[node], in[child]);
      if (in[node] > in[child]) roadPair.emplace_back(make_pair(node, child));
    } else {
      bool res{};
      res = dfs(child, node);
      if (!res) return false;
      if (low[child] > in[node]) return false;
      low[node] = min(low[node], low[child]);
      roadPair.emplace_back(make_pair(node, child));
    }
  }
  return true;
}
void globalReset(long long n) {
  for (size_t i{}; i <= n; ++i) {
    vis[i] = 0;
  }
}
int main() {
  long long n{}, m{}, a{}, b{}, q{};
  cin >> n >> m;
  q = m;
  while (m--) {
    cin >> a >> b;
    ar[a].emplace_back(b);
    ar[b].emplace_back(a);
  }
  if (!dfs(1, -1))
    cout << 0 << endl;
  else {
    for (size_t i{}; i < roadPair.size(); ++i) {
      cout << roadPair[i].first << " " << roadPair[i].second << endl;
    }
  }
  return 0;
}
