#include <bits/stdc++.h>
using namespace std;
int n, v, c;
vector<bool> ins;
vector<int> s, num, low, com, par;
vector<vector<int>> e;
void dfs(int i, int p = -1) {
  num[i] = low[i] = v++;
  par[i] = p;
  s.push_back(i);
  ins[i] = true;
  for (int j : e[i]) {
    if (j == p) {
      p = -1;
      continue;
    }
    if (num[j] == -1) dfs(j, i);
    if (ins[j]) low[i] = min(low[i], low[j]);
  }
  if (low[i] == num[i]) {
    int j;
    do {
      j = s.back();
      s.pop_back();
      ins[j] = false;
      com[j] = c;
    } while (j != i);
    c++;
  }
}
void stronglyConnectedComponents() {
  v = c = 0;
  ins.assign(n, false);
  num.assign(n, -1);
  low.resize(n);
  com.resize(n);
  par.resize(n);
  for (int i = 0; i < n; i++)
    if (num[i] == -1) dfs(i);
}
int main() {
  int m, a, b;
  cin >> n >> m;
  e.resize(n);
  vector<pair<int, int>> edg;
  for (int i = 0; i < m; i++) {
    cin >> a >> b, a--, b--;
    e[a].push_back(b);
    e[b].push_back(a);
    edg.push_back({a, b});
  }
  stronglyConnectedComponents();
  vector<int> sum(c);
  vector<vector<int>> ebc(c);
  for (int i = 0; i < n; i++) {
    sum[com[i]]++;
    for (int j : e[i])
      if (com[i] != com[j]) ebc[com[i]].push_back(com[j]);
  }
  vector<bool> u(c);
  priority_queue<pair<int, int>> pq;
  for (int i = 0; i < c; i++) pq.push({sum[i], i});
  int ms = n;
  while (!pq.empty()) {
    int i = pq.top().second;
    pq.pop();
    ms = min(ms, sum[i]);
    if (u[i]) continue;
    u[i] = true;
    for (int j : ebc[i])
      if (!u[j]) {
        sum[j] += sum[i];
        pq.push({sum[j], j});
      }
  }
  cout << ms << "\n";
  for (auto ed : edg) {
    int i = ed.first, j = ed.second;
    if (com[i] != com[j] && sum[com[i]] > sum[com[j]] ||
        com[i] == com[j] && (par[j] == i || par[i] != j && num[i] > num[j]))
      cout << i + 1 << " " << j + 1 << "\n";
    else
      cout << j + 1 << " " << i + 1 << "\n";
  }
}
