#include <bits/stdc++.h>
using namespace std;
long long int m = 1000000007;
vector<long long int> arr[100005];
long long int visit[100005] = {};
long long int in[100005] = {};
long long int low[100005] = {};
bool bridge = false;
vector<pair<long long int, long long int> > edge;
long long int T = 0;
void dfs(long long int node, long long int par) {
  visit[node] = 1;
  long long int y = arr[node].size();
  in[node] = low[node] = T++;
  for (int i = 0; i < y; i++) {
    if (arr[node][i] == par) continue;
    if (visit[arr[node][i]]) {
      low[node] = min(low[node], in[arr[node][i]]);
      if (in[arr[node][i]] > in[node])
        edge.push_back(make_pair(arr[node][i], node));
    } else {
      visit[arr[node][i]] = 1;
      dfs(arr[node][i], node);
      if (low[arr[node][i]] > in[node]) {
        bridge = true;
        return;
      }
      low[node] = min(low[node], low[arr[node][i]]);
      edge.push_back(make_pair(node, arr[node][i]));
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int q = 1;
  while (q--) {
    long long int n, m;
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
      long long int a, b;
      cin >> a >> b;
      arr[a].push_back(b);
      arr[b].push_back(a);
    }
    dfs(1, -1);
    if (bridge)
      cout << 0 << endl;
    else {
      for (int i = 0; i < edge.size(); i++) {
        cout << edge[i].first << " " << edge[i].second << endl;
      }
    }
  }
}
