#include <bits/stdc++.h>
#include <pthread.h>
#define ll long long
#define deb(x) cout << #x << " : " << x << endl;
#define take_input(a)                                                          \
  for (auto &x : a)                                                            \
    cin >> x;
#define _output(a)                                                             \
  for (auto &x : a)                                                            \
    cout << x << " ";                                                          \
  cout << endl;
#define srt(a) sort(a.begin(), a.end())
#define nl "\n"
using namespace std;

class Graph {
private:
  int V;
  list<int> *adj;
  bool *visited;
  int *tin;
  int *low;
  int timer = 1;
  map<pair<int, int>, int> ans;

public:
  bool isPossible = true;
  Graph(int n);
  void addEdge(int u, int v);
  void dfs(int node, int parent);
  void printSol();
};

Graph::Graph(int n) {
  V = n + 1;
  adj = new list<int>[V];
  visited = new bool[V];
  tin = new int[V];
  low = new int[V];
}

void Graph::addEdge(int u, int v) {
  adj[u].push_back(v);
  adj[v].push_back(u);
}

void Graph::dfs(int node, int parent) {
  if (!isPossible)
    return;
  visited[node] = true;
  tin[node] = timer;
  low[node] = timer;
  timer++;

  for (auto v : adj[node]) {
    if (v == parent)
      continue;

    if (ans.find({node, v}) == ans.end() && ans.find({v, node}) == ans.end())
      ans[{node, v}] = true;

    if (!visited[v]) {
      dfs(v, node);

      low[node] = min(low[node], low[v]);
      if (tin[node] < low[v]) {
        isPossible = false;
        return;
      }

    } else {
      low[node] = min(low[node], low[v]);
    }
  }
}

void Graph::printSol() {
  for (auto i : ans) {
    cout << i.first.first << " " << i.first.second << nl;
  }
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int T = 1;
  // cin >> T;

  while (T--) {
    int n, m;
    cin >> n >> m;
    Graph g(n);

    for (int i = 0; i < m; i++) {
      int u, v;
      cin >> u >> v;
      g.addEdge(u, v);
    }

    g.dfs(1, 1);

    if (g.isPossible)
      g.printSol();
    else
      cout << 0 << nl;
  }

  return 0;
}
