#include <bits/stdc++.h>
using namespace std;
int e1[400005];
int e2[400005];
int b[400005];
int d[400005];
int c[400005];
bool isb[400005];
bool o[400005];
bool ao[400005];
int nn[400005];
int q[400005];
int f[400005];
vector<int> g[400005];
vector<pair<int, int> > g2[400005];
int tt;
int n, m;
int nc;
void dfs(int u, int pe) {
  b[u] = d[u] = tt++;
  for (int _ = 0, to = g[u].size(); _ < to; ++_) {
    int ne = g[u][_];
    if (ne == pe) continue;
    if (!ao[ne]) {
      o[ne] = e1[ne] == u;
      ao[ne] = true;
    }
    int v = e1[ne] ^ e2[ne] ^ u;
    if (d[v] < 0) {
      dfs(v, ne);
      if (b[v] > d[u]) {
        isb[ne] = true;
      }
      b[u] = min(b[u], b[v]);
    } else if (d[v] < d[u])
      b[u] = min(b[u], d[v]);
  }
}
void dfs2(int x, int cc) {
  if (c[x] >= 0) return;
  c[x] = cc;
  nn[cc]++;
  for (int i = 0, to = g[x].size(); i < to; ++i) {
    int e = g[x][i];
    if (isb[e]) continue;
    dfs2(e1[e] ^ e2[e] ^ x, cc);
  }
}
bool dfs3(int x, int p, int k) {
  q[x] = nn[x];
  f[x] = max(k - q[x], 0);
  for (int i = 0, to = g2[x].size(); i < to; ++i) {
    int y = g2[x][i].first;
    int e = g2[x][i].second;
    if (y == p) continue;
    if (dfs3(y, x, k)) {
      q[x] += q[y];
      o[e] = c[e1[e]] == x;
      f[x] = max(k - q[x], 0);
    } else {
      o[e] = c[e2[e]] == x;
    }
  }
  for (int i = 0, to = g2[x].size(); i < to; ++i) {
    int y = g2[x][i].first;
    if (y == p) continue;
    if (f[y]) f[x] = max(f[x], f[y] - q[x]);
  }
  return f[x] == 0;
}
bool can(int k) { return dfs3(0, -1, k); }
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0, to = m; i < to; ++i) {
    scanf("%d%d", e1 + i, e2 + i);
    e1[i]--;
    e2[i]--;
    g[e1[i]].push_back(i);
    g[e2[i]].push_back(i);
  }
  memset(d, -1, sizeof(d));
  dfs(0, -1);
  memset(c, -1, sizeof(c));
  for (int i = 0, to = n; i < to; ++i) {
    if (c[i] < 0) {
      dfs2(i, nc);
      nc++;
    }
  }
  for (int i = 0, to = m; i < to; ++i) {
    if (isb[i]) {
      g2[c[e1[i]]].push_back(make_pair(c[e2[i]], i));
      g2[c[e2[i]]].push_back(make_pair(c[e1[i]], i));
    }
  }
  int s = 0, e = n + 1;
  while (e - s > 1) {
    int m = (s + e) / 2;
    if (can(m))
      s = m;
    else
      e = m;
  }
  assert(can(s));
  printf("%d\n", s);
  for (int i = 0, to = m; i < to; ++i) {
    if (o[i])
      printf("%d %d\n", e1[i] + 1, e2[i] + 1);
    else
      printf("%d %d\n", e2[i] + 1, e1[i] + 1);
  }
  return 0;
}
