#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 100 * 1000 + 10;
vector<int> graph[MAX_N], num[MAX_N];
int n, m;
bool mark[MAX_N], mm[3 * MAX_N];
map<pair<int, int>, int> dir;
void DFS(int v) {
  mark[v] = true;
  for (int i = 0; i < graph[v].size(); i++) {
    int u = graph[v][i];
    if (!mm[num[v][i]]) {
      dir[make_pair(v, u)] = 1;
      dir[make_pair(u, v)] = -1;
      mm[num[v][i]] = true;
    }
    if (!mark[u]) DFS(u);
  }
}
void F(int v) {
  mark[v] = true;
  for (int i = 0; i < graph[v].size(); i++) {
    int u = graph[v][i];
    if (!mark[u] && dir[make_pair(v, u)] == -1) F(u);
  }
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < m; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    a--;
    b--;
    graph[a].push_back(b);
    num[a].push_back(i);
    graph[b].push_back(a);
    num[b].push_back(i);
  }
  DFS(0);
  for (int i = 0; i < n; i++) mark[i] = false;
  F(0);
  bool check = false;
  for (int i = 0; i < n; i++)
    if (!mark[i]) {
      check = true;
      break;
    }
  if (check) {
    printf("0\n");
    return 0;
  }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < graph[i].size(); j++)
      if (dir[make_pair(i, graph[i][j])] == 1)
        printf("%d %d\n", i + 1, graph[i][j] + 1);
  return 0;
}
