#include <bits/stdc++.h>
using namespace std;
const int maxn = 100 * 1000 + 10;
bool mark[maxn];
vector<int> v[maxn];
bool ok = false;
int d[maxn];
vector<pair<int, int> > edge;
inline int dfs(int id) {
  mark[id] = 1;
  int ret = d[id];
  for (int i = 0; i < v[id].size(); ++i) {
    int x = v[id][i];
    if (mark[x] == 0) {
      d[x] = d[id] + 1;
      ret = min(ret, dfs(x));
      edge.push_back(pair<int, int>(id, x));
    } else if (d[x] != d[id] - 1)
      ret = min(ret, d[x]);
  }
  for (int i = 0; i < v[id].size(); ++i) {
    int x = v[id][i];
    if (d[x] != d[id] + 1 && d[x] > d[id])
      edge.push_back(pair<int, int>(x, id));
  }
  if (ret >= d[id] && d[id] != 0) ok = true;
  return ret;
}
int main() {
  ios_base::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  while (m-- > 0) {
    int fi, se;
    cin >> fi >> se;
    v[fi].push_back(se);
    v[se].push_back(fi);
  }
  int t = dfs(1);
  if (ok) {
    cout << 0 << endl;
    return 0;
  }
  for (int i = 0; i < edge.size(); ++i) {
    cout << edge[i].first << ' ' << edge[i].second << endl;
  }
  return 0;
}
