#include <bits/stdc++.h>
using namespace std;
const long double pi = 3.14159265358979323846;
const int inf = INT_MAX;
const long int mod = 1000000007;
const int size = 100001;
vector<int> arr[size];
vector<pair<int, int> > ans;
bool visit[size];
int in[size], low[size];
int timer = 0;
int flag = 0;
void dfs(int node, int par = -1) {
  in[node] = low[node] = timer++;
  visit[node] = 1;
  for (int child : arr[node]) {
    if (child == par) continue;
    if (visit[child] == 0) {
      ans.push_back({node, child});
      dfs(child, node);
      low[node] = min(low[node], low[child]);
      if (low[child] > in[node]) {
        flag = 1;
        return;
      }
    } else {
      low[node] = min(low[node], in[child]);
      if (in[node] > in[child]) ans.push_back({node, child});
    }
  }
}
void solve() {
  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);
  if (flag == 1)
    cout << "0";
  else {
    for (auto it : ans) {
      cout << it.first << " " << it.second << endl;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  while (t--) solve();
  return 0;
}
