#include <bits/stdc++.h>
using namespace std;
vector<int> adlist[1000005];
vector<pair<int, int> > one;
int vis[1000005];
int timer;
int intimer[1000005], low[1000005];
int flag = -1;
void dfs(int node, int par) {
  vis[node] = 1;
  intimer[node] = low[node] = timer;
  timer++;
  for (int i = 0; i < adlist[node].size(); i++) {
    int child = adlist[node][i];
    if (child == par) continue;
    if (vis[child] == 1) {
      if (intimer[node] > intimer[child]) one.push_back(make_pair(node, child));
      low[node] = min(low[node], intimer[child]);
    } else {
      one.push_back(make_pair(node, child));
      dfs(child, node);
      if (intimer[node] < low[child]) {
        flag = 0;
        break;
      }
      low[node] = min(low[node], low[child]);
    }
  }
}
int main() {
  int n, e, a, b;
  cin >> n >> e;
  for (int i = 1; i <= e; i++)
    cin >> a >> b, adlist[a].push_back(b), adlist[b].push_back(a);
  dfs(1, -1);
  if (flag == -1)
    for (int i = 0; i < one.size(); i++) {
      cout << one[i].first << " " << one[i].second << endl;
    }
  else {
    cout << 0;
  }
  return 0;
}
