#include <bits/stdc++.h>
using namespace std;
const long long N = 200011;
int n, m, dp[N], dis[N];
vector<int> g[N];
bool mark[N];
void dfs(int v, int par) {
  mark[v] = 1;
  dp[v] = dis[v];
  for (int i = 0; i < g[v].size(); i++) {
    int u = g[v][i];
    if (u == par) continue;
    if (!mark[u]) {
      dis[u] = dis[v] + 1;
      dfs(u, v);
      dp[v] = min(dp[v], dp[u]);
    } else
      dp[v] = min(dp[v], dis[u]);
  }
  if (v != 1 and dis[v] <= dp[v]) {
    cout << 0;
    exit(0);
  }
}
void sdf(int v, int par) {
  mark[v] = 1;
  for (int i = 0; i < g[v].size(); i++) {
    int u = g[v][i];
    if (!mark[u]) {
      printf("%d %d\n", v, u);
      sdf(u, v);
    } else {
      if (dis[v] > dis[u] and u != par) printf("%d %d\n", v, u);
    }
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= m; i++) {
    int u, v;
    scanf("%d%d", &v, &u);
    g[v].push_back(u);
    g[u].push_back(v);
  }
  dfs(1, 0);
  memset(mark, 0, sizeof(mark));
  sdf(1, 0);
}
