#include <bits/stdc++.h>
using namespace std;
const int N = 5005;
int n, m, vs[N], d[N], as;
vector<int> G[N];
int dfs(int u, int v, int s) {
  vs[u] = s;
  if (G[u].size() < as) return G[u].push_back(v), 1;
  for (int& w : G[u])
    if (vs[w] < s && dfs(w, u, s)) return w = v;
  return 0;
}
int main() {
  cin >> n >> m;
  int u, v;
  for (int i = (1); i <= (m); i++) {
    scanf("%d%d", &u, &v);
    if (!dfs(u, v, i * 2) && !dfs(v, u, i * 2 + 1)) as++, G[u].push_back(v);
  }
  cout << as << endl;
  for (int u = (1); u <= (n); u++)
    for (int v : G[u]) printf("%d %d\n", u, v);
  return 0;
}
