#include <bits/stdc++.h>
using namespace std;
void dfs1(int u, int par, vector<vector<int>> &adj, vector<bool> &vis,
          unordered_set<string> &mp) {
  vis[u] = 1;
  for (int child : adj[u]) {
    if (child == par) continue;
    if (vis[child] == 0) {
      cout << u << " " << child << '\n';
      string s = to_string(u) + " " + to_string(child);
      mp.insert(s);
      dfs1(child, u, adj, vis, mp);
    } else {
      string s = to_string(u) + " " + to_string(child);
      string s1 = to_string(child) + " " + to_string(u);
      if (mp.find(s) == mp.end() && mp.find(s1) == mp.end()) {
        mp.insert(s);
        cout << u << " " << child << '\n';
      }
    }
  }
}
void dfs(int u, int par, vector<vector<int>> &adj, vector<int> &disc,
         vector<int> &low, int &timer, bool &flag) {
  disc[u] = low[u] = timer++;
  for (int child : adj[u]) {
    if (child == par) continue;
    if (disc[child] != -1) {
      low[u] = min(low[u], disc[child]);
    } else {
      dfs(child, u, adj, disc, low, timer, flag);
      low[u] = min(low[u], low[child]);
      if (flag == 1 && low[child] > disc[u]) {
        cout << "0\n";
        flag = 0;
      }
    }
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<vector<int>> adj(n + 1);
  vector<int> disc(n + 1, -1), low(n + 1, -1);
  for (int i = 0; i < m; i++) {
    int x, y;
    cin >> x >> y;
    adj[x].push_back(y);
    adj[y].push_back(x);
  }
  bool flag = 1;
  int timer = 0;
  dfs(1, -1, adj, disc, low, timer, flag);
  if (flag == 1) {
    unordered_set<string> mp;
    vector<bool> vis(n + 1, 0);
    dfs1(1, -1, adj, vis, mp);
  }
  return 0;
}
