#include <bits/stdc++.h>
using namespace std;
vector<long long int> adj[100001];
long long int vis[100001];
long long int in[100001], low[100001];
vector<pair<long long int, long long int> > edgeList;
bool bridge;
long long int timer;
void dfs(long long int node, long long int parent) {
  vis[node] = 1;
  in[node] = low[node] = timer;
  timer++;
  for (auto child : adj[node]) {
    if (child == parent) continue;
    if (vis[child] == 1) {
      low[node] = min(low[node], in[child]);
      if (in[node] > in[child]) edgeList.push_back({node, child});
    } else {
      dfs(child, node);
      if (low[child] > in[node]) {
        bridge = true;
        return;
      }
      edgeList.push_back({node, child});
      low[node] = min(low[node], low[child]);
    }
  }
}
void dfsb(long long int src) {
  vis[src] = 1;
  cout << src << "\n";
  for (auto i : adj[src]) {
    if (!vis[i]) dfsb(i);
  }
}
void solve() {
  long long int V, e;
  long long int u, v;
  cin >> V >> e;
  while (e--) {
    cin >> u >> v;
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  dfs(1, -1);
  if (bridge == true) {
    cout << 0;
  } else {
    for (auto i : edgeList) {
      cout << i.first << " " << i.second << "\n";
    }
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  solve();
  return 0;
}
