#include <bits/stdc++.h>
using namespace std;
vector<int> v[100005];
int flag = 0;
int vis[100005];
vector<pair<int, int> > orient;
int timer = 0;
int in[100005], low[100005];
void dfs(int node, int par) {
  timer++;
  in[node] = low[node] = timer;
  for (auto i : v[node]) {
    if (i ^ par) {
      if (vis[i] == 1) continue;
      if (vis[i] == 0) {
        low[node] = min(low[node], in[i]);
        orient.push_back({node, i});
        continue;
      }
      vis[i] = 0;
      dfs(i, node);
      if (low[i] > in[node]) {
        flag = 1;
        return;
      }
      low[node] = min(low[node], low[i]);
      orient.push_back({node, i});
    }
  }
  vis[node] = 1;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= m; i++) {
    int a, b;
    cin >> a >> b;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  for (int i = 0; i <= n; i++) vis[i] = -1;
  vis[1] = 0;
  dfs(1, 1);
  if (flag) {
    cout << 0 << '\n';
    return 0;
  }
  for (int i = 0; i < orient.size(); i++) {
    cout << orient[i].first << " " << orient[i].second << '\n';
  }
}
