#include <bits/stdc++.h>
using namespace std;
vector<int> arr[100001];
int visited[100001], in[100001], low[100001];
int timer, flag = 0;
vector<pair<int, int>> edgeList;
void dfs(int node, int parent) {
  visited[node] = 1;
  in[node] = low[node] = timer++;
  for (int child : arr[node]) {
    if (child == parent) continue;
    if (visited[child] == 1) {
      low[node] = min(low[node], in[child]);
      if (in[child] < in[node]) edgeList.push_back({node, child});
    } else {
      dfs(child, node);
      if (in[node] < low[child]) {
        flag = 1;
        return;
      }
      low[node] = min(low[child], low[node]);
      edgeList.push_back({node, child});
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m, a, b;
  cin >> n >> m;
  while (m--) {
    cin >> a >> b, arr[a].push_back(b), arr[b].push_back(a);
  }
  dfs(1, -1);
  if (flag == 1) {
    cout << 0;
  } else {
    for (auto p : edgeList) cout << p.first << " " << p.second << "\n";
  }
  return 0;
}
