#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) {}
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << '\n';
  err(++it, args...);
}
const auto start_time = std::chrono::high_resolution_clock::now();
void timecalculater() {}
template <typename A, typename B>
string to_string(pair<A, B> p);
string to_string(const string& second) { return '"' + second + '"'; }
string to_string(const char* second) { return to_string((string)second); }
string to_string(bool b) { return (b ? "true" : "false"); }
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (int i = 0; i < static_cast<int>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
void debug_out() { cerr << '\n'; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
struct custom_hash {
  static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM =
        chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};
vector<long long> dp(200005, 0), lvl(200005, 0);
unordered_map<long long, vector<long long> > e;
vector<pair<long long, long long> > res;
long long dfs(long long u, long long par) {
  lvl[u] = lvl[par] + 1;
  for (auto p : e[u]) {
    if (par == p) {
      res.push_back({p, u});
      continue;
    }
    if (lvl[p] == 0) {
      dp[u] += dfs(p, u);
    } else if (lvl[p] > lvl[u]) {
      dp[u]--;
      res.push_back({p, u});
    } else {
      dp[u]++;
    }
  }
  return dp[u];
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t, q, n, m, prev, maxx, i, j, k1, k2, k3, k, x, y, flag, sum, cnt,
      ans, minn, cur;
  cin >> n >> m;
  for (i = 0; i < m; i++) {
    cin >> x >> y;
    e[x].push_back(y);
    e[y].push_back(x);
  }
  long long root = 1;
  dfs(root, 0);
  cnt = 0;
  for (i = 1; i < n + 1; i++) {
    if (root == i) continue;
    if (dp[i] == 0) {
      cnt++;
    }
  }
  if (cnt) {
    cout << 0 << '\n';
  } else {
    for (auto p : res) {
      cout << p.first << " " << p.second << '\n';
    }
  }
  return 0;
}
