#include <bits/stdc++.h>
using namespace std;
class node {
 public:
  vector<int> near, neard;
};
int parent[100010];
int level[100010];
bool df[100010] = {0};
node a[100010];
vector<int> tmp;
void dfs(int j) {
  df[j] = 1;
  vector<int> v = a[j].near;
  for (int i = 0; i < v.size(); i++) {
    if (df[v[i]]) continue;
    parent[v[i]] = j;
    level[v[i]] = level[j] + 1;
    dfs(v[i]);
  }
}
void dfs1(int j) {
  df[j] = 1;
  tmp.push_back(j);
  vector<int> v = a[j].neard;
  for (int i = 0; i < v.size(); i++) {
    if (!df[v[i]]) dfs1(v[i]);
  }
}
vector<pair<int, int> > edges, fedges;
int main() {
  int n, m;
  cin >> n >> m;
  int x, y;
  for (int i = 1; i <= m; i++) {
    scanf("%d%d", &x, &y);
    a[x].near.push_back(y);
    a[y].near.push_back(x);
    edges.push_back(pair<int, int>(x, y));
  }
  level[1] = 0;
  dfs(1);
  for (int i = 0; i < m; i++) {
    x = edges[i].first;
    y = edges[i].second;
    if (parent[x] == y) {
      a[x].neard.push_back(y);
      fedges.push_back(pair<int, int>(y, x));
      continue;
    }
    if (parent[y] == x) {
      a[y].neard.push_back(x);
      fedges.push_back(pair<int, int>(x, y));
      continue;
    }
    if (level[x] < level[y]) {
      a[x].neard.push_back(y);
      fedges.push_back(pair<int, int>(y, x));
      continue;
    }
    a[y].neard.push_back(x);
    fedges.push_back(pair<int, int>(x, y));
  }
  for (int i = 1; i <= n; i++) df[i] = 0;
  tmp.clear();
  dfs1(1);
  if (tmp.size() != n) {
    cout << 0 << endl;
    return 0;
  }
  for (int i = 0; i < m; i++)
    printf("%d %d\n", fedges[i].first, fedges[i].second);
}
