#include <bits/stdc++.h>
using namespace std;
const int N = 4e4 + 1;
int n, m, x[N], y[N], freq[N], q[N], vis[N], match[N], T, ans[N];
vector<int> g[N];
bool get(int u) {
  vis[u] = T;
  for (auto i : g[u]) {
    if (match[i] != -1 && vis[match[i]] == T) continue;
    if (match[i] == -1 || get(match[i])) {
      match[i] = u;
      return 1;
    }
  }
  return false;
}
int main() {
  scanf("%d%d", &n, &m);
  if (!m) return puts("0"), 0;
  memset(match, -1, sizeof match);
  for (int i = 0; i < m; i++)
    scanf("%d %d", x + i, y + i), x[i], y[i], freq[x[i]]++, freq[y[i]]++;
  int id = n + 1;
  for (int i = 0; i < m; i++) {
    g[x[i]].push_back(id);
    g[y[i]].push_back(id++);
  }
  int can = 0;
  queue<int> q;
  for (int i = 1; i <= n; i++) q.push(i);
  while (q.size()) {
    int x = q.front();
    q.pop();
    if (freq[x]) {
      freq[x]--;
      T++;
      if (get(x)) q.push(x), ans[x]++;
    }
  }
  for (int i = 1; i <= n; i++) can = max(can, ans[i]);
  printf("%d\n", can);
  for (int i = 0; i < m; i++)
    if (match[i + n + 1] == y[i])
      printf("%d %d\n", y[i], x[i]);
    else
      printf("%d %d\n", x[i], y[i]);
}
