#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const int maxm = 21111;
const int maxn = 5001;
int node, src, dest, edge;
int ver[maxm], flow[maxm], nxt[maxm];
int head[maxn], work[maxn], dis[maxn], q[maxn];
void prepare(int _node, int _src, int _dest) {
  node = _node, src = _src, dest = _dest;
  for (int i = 0; i < node; ++i) head[i] = -1;
  edge = 0;
}
void add_edge(int u, int v, int c) {
  ver[edge] = v, flow[edge] = c, nxt[edge] = head[u], head[u] = edge++;
  ver[edge] = u, flow[edge] = 0, nxt[edge] = head[v], head[v] = edge++;
}
bool Dinic_bfs() {
  int i, u, v, l, r = 0;
  for (i = 0; i < node; ++i) dis[i] = -1;
  dis[q[r++] = src] = 0;
  for (l = 0; l < r; ++l)
    for (i = head[u = q[l]]; i >= 0; i = nxt[i])
      if (flow[i] && dis[v = ver[i]] < 0) {
        dis[q[r++] = v] = dis[u] + 1;
        if (v == dest) return 1;
      }
  return 0;
}
int Dinic_dfs(int u, int exp) {
  if (u == dest) return exp;
  for (int &i = work[u], v, tmp; i >= 0; i = nxt[i])
    if (flow[i] && dis[v = ver[i]] == dis[u] + 1 &&
        (tmp = Dinic_dfs(v, min(exp, flow[i]))) > 0) {
      flow[i] -= tmp;
      flow[i ^ 1] += tmp;
      return tmp;
    }
  return 0;
}
int Dinic_flow() {
  int i, ret = 0, delta;
  while (Dinic_bfs()) {
    for (i = 0; i < node; ++i) work[i] = head[i];
    while (delta = Dinic_dfs(src, inf)) ret += delta;
  }
  return ret;
}
pair<int, int> ps[maxm];
int n, m;
int indeg[maxn], outdeg[maxn];
bool check(int mid) {
  int exp = 0;
  memset(indeg, 0, sizeof(indeg));
  memset(outdeg, 0, sizeof(outdeg));
  prepare(n + 2, 0, n + 1);
  for (int i = 0; i < m; ++i) {
    int u = ps[i].first, v = ps[i].second;
    outdeg[u]++;
    indeg[v]++;
    add_edge(u, v, 1);
  }
  for (int i = 1; i <= n; ++i) {
    if (outdeg[i] > mid) {
      add_edge(0, i, outdeg[i] - mid);
      exp += outdeg[i] - mid;
    }
    if (outdeg[i] < mid) {
      add_edge(i, n + 1, mid - outdeg[i]);
    }
  }
  int f = Dinic_flow();
  return exp == f;
}
void printpath() {
  for (int i = 1; i <= n; i++) {
    for (int e = head[i]; e != -1; e = nxt[e]) {
      if (e & 1) continue;
      int v = ver[e];
      if (v < 1 || v > n || v < i) continue;
      if (flow[e]) {
        printf("%d %d\n", i, v);
      } else {
        printf("%d %d\n", v, i);
      }
    }
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < m; ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    if (a > b) swap(a, b);
    ps[i] = make_pair(a, b);
  }
  int l = -1, r = n;
  while (r - l > 1) {
    int mid = (l + r) / 2;
    if (check(mid)) {
      r = mid;
    } else {
      l = mid;
    }
  }
  if (check(l)) {
    cout << l << endl;
  } else {
    check(r);
    cout << r << endl;
  }
  printpath();
  return 0;
}
