#include <bits/stdc++.h>
using namespace std;
const int maxn = 1E5 + 1;
int a, b, c, d, e;
vector<int> v[maxn];
vector<pair<int, int> > ans;
int up[maxn];
int h = 1;
int h_[maxn];
bool f = 0;
void dfs(int x, int last) {
  h_[x] = h++;
  up[x] = h_[x];
  for (int i = 0; i < v[x].size(); ++i)
    if (v[x][i] != last) {
      if (h_[v[x][i]] < h_[x]) {
        if (h_[v[x][i]] == 0) dfs(v[x][i], x);
        up[x] = min(up[x], up[v[x][i]]);
        ans.push_back(make_pair(x, v[x][i]));
      }
    }
  --h;
  if (up[x] == h && x != 1) f = 1;
}
int main() {
  cin >> a >> b;
  for (int i = 0; i < b; ++i) {
    cin >> c >> d;
    v[c].push_back(d);
    v[d].push_back(c);
  }
  dfs(1, 1);
  if (f)
    cout << "0\n";
  else {
    for (int i = 0; i < ans.size(); ++i)
      cout << ans[i].first << ' ' << ans[i].second << "\n";
  }
  return 0;
}
