#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
vector<int> G[N];
pair<int, int> EDGES[N * 3];
int n, m, H[N], D[N], v[N], nr, T[N];
inline int min(int a, int b) { return a < b ? a : b; }
void DFS(int k) {
  int i;
  v[k] = 1;
  for (i = 0; i < G[k].size(); ++i)
    if (!v[G[k][i]]) {
      H[G[k][i]] = H[k] + 1;
      T[G[k][i]] = k;
      EDGES[++nr] = make_pair(k, G[k][i]);
      DFS(G[k][i]);
      D[k] = min(D[k], D[G[k][i]]);
    }
  for (i = 0; i < G[k].size(); ++i)
    if (v[G[k][i]] == 1 && T[k] != G[k][i] && H[k] >= H[G[k][i]]) {
      D[k] = min(D[k], H[G[k][i]]);
      EDGES[++nr] = make_pair(k, G[k][i]);
    }
  if (k > 1 && D[k] >= H[k]) {
    cout << 0 << '\n';
    exit(0);
  }
}
int main() {
  int i, x, y;
  cin >> n >> m;
  for (i = 1; i <= m; ++i) {
    cin >> x >> y;
    G[x].push_back(y);
    G[y].push_back(x);
  }
  for (i = 1; i <= n; ++i) D[i] = 10000000;
  DFS(1);
  if (D[1] > H[1]) {
    cout << 0 << '\n';
    return 0;
  }
  for (i = 1; i <= nr; ++i)
    cout << EDGES[i].first << " " << EDGES[i].second << '\n';
  return 0;
}
