#include <bits/stdc++.h>
using namespace std;
vector<int> adj[100005];
vector<pair<int, int> > res;
int n, m, D, depth[100005], vert[100005], doomed = 0;
void dfs(int node, int par) {
  vert[node] = depth[node] = ++D;
  for (int i = 0; i < adj[node].size(); i++) {
    if (adj[node][i] == par) continue;
    if (vert[adj[node][i]] == 0) {
      res.push_back(make_pair(node, adj[node][i]));
      dfs(adj[node][i], node);
      depth[node] = min(depth[node], depth[adj[node][i]]);
      if (vert[node] < depth[adj[node][i]]) doomed = 1;
    } else {
      depth[node] = min(depth[node], vert[adj[node][i]]);
      if (vert[node] > vert[adj[node][i]])
        res.push_back(make_pair(node, adj[node][i]));
    }
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; i++) {
    int a, b;
    scanf("%d%d", &a, &b);
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  dfs(1, -1);
  if (doomed) {
    printf("0");
    return 0;
  }
  for (int i = 0; i < res.size(); i++)
    printf("%d %d\n", res[i].first, res[i].second);
}
