#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 7;
const int inf = 1e8;
int mark[maxn];
vector<int> adj[maxn];
vector<int> adjp[2][maxn];
void dfs(int v, int t) {
  mark[v] = t;
  for (int i = 0; i < adj[v].size(); ++i) {
    int u = adj[v][i];
    if (mark[v] < mark[u]) {
      if (mark[u] == inf)
        adjp[0][v].push_back(u);
      else
        adjp[0][u].push_back(v);
    }
    if (mark[u] == inf) dfs(u, t + 1);
  }
}
void dfsp(int v, int t) {
  mark[v] = true;
  for (int i = 0; i < adjp[t][v].size(); ++i) {
    int u = adjp[t][v][i];
    if (!mark[u]) dfsp(u, t);
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < m; ++i) {
    int u, v;
    cin >> u >> v;
    u--, v--;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  for (int i = 0; i < n; ++i) mark[i] = inf;
  dfs(0, 1);
  memset(mark, 0, sizeof mark);
  dfsp(0, 0);
  for (int i = 0; i < n; ++i)
    if (!mark[i]) {
      cout << "0\n";
      return 0;
    }
  memset(mark, 0, sizeof mark);
  for (int i = 0; i < n; ++i)
    while (!adjp[0][i].empty()) {
      adjp[1][adjp[0][i].back()].push_back(i);
      adjp[0][i].pop_back();
    }
  dfsp(0, 1);
  for (int i = 0; i < n; ++i)
    if (!mark[i]) {
      cout << "0\n";
      return 0;
    }
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < adjp[1][i].size(); ++j)
      cout << i + 1 << ' ' << adjp[1][i][j] + 1 << '\n';
  return 0;
}
