#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, m, a, b;
vector<int> adj[N], undir[N];
bool seen[N], ex[N], flag;
void dfs(int x, int parent) {
  seen[x] = true;
  ex[x] = true;
  for (int i = 0; i < adj[x].size(); i++) {
    int to = adj[x][i];
    if (!seen[to] || (to != parent && ex[to])) {
      undir[to].push_back(x);
    }
    if (!seen[to]) {
      dfs(to, x);
    }
  }
  ex[x] = false;
}
void dfs2(int x) {
  seen[x] = true;
  for (int i = 0; i < undir[x].size(); i++) {
    if (!seen[undir[x][i]]) {
      dfs2(undir[x][i]);
    }
  }
}
int main() {
  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> a >> b;
    a--;
    b--;
    adj[a].push_back(b);
    adj[b].push_back(a);
  }
  memset(seen, 0, sizeof(seen));
  dfs(0, -1);
  memset(seen, 0, sizeof(seen));
  dfs2(0);
  flag = false;
  for (int i = 0; i < n; i++)
    if (!seen[i]) flag = true;
  if (flag) {
    cout << 0 << endl;
  } else {
    for (int i = 0; i < n; i++)
      for (int j = 0; j < undir[i].size(); j++)
        cout << (undir[i][j] + 1) << " " << (i + 1) << endl;
  }
}
