#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
template <class T>
int getbit(T x, int pos) {
  return (x >> (pos - 1)) & 1;
}
template <class T>
void turn_on(T &x, int pos) {
  x = x | ((T)1 << (pos - 1));
}
template <class T>
void turn_off(T &x, int pos) {
  x = x & ~((T)1 << (pos - 1));
}
template <class T>
T sqr(T a) {
  return a * a;
}
int n, m, t, assigned[100002], visited[100002];
vector<int> a[100002];
pair<int, int> p[100002];
bool visit(int u) {
  if (visited[u] != t)
    visited[u] = t;
  else
    return false;
  for (int i = 0; i < (int)a[u % n].size(); ++i) {
    int v = a[u % n][i];
    if (assigned[v] == -1 || visit(assigned[v])) {
      assigned[v] = u;
      return true;
    }
  }
  return false;
}
void solve() {
  int cnt = 0, i = 0;
  memset(assigned, -1, sizeof(assigned));
  while (cnt < m) {
    ++t;
    cnt += visit(i);
    ++i;
  }
  --i;
  cout << i / n + 1 << '\n';
  for (int i = 1; i <= m; ++i) {
    int tmp = assigned[i] % n + 1;
    if (p[i].first + 1 == tmp)
      cout << tmp << ' ' << p[i].second + 1 << '\n';
    else
      cout << tmp << ' ' << p[i].first + 1 << '\n';
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= m; ++i) {
    cin >> p[i].first >> p[i].second;
    p[i].first--;
    p[i].second--;
    a[p[i].first].push_back(i);
    a[p[i].second].push_back(i);
  }
  if (m == 0) {
    cout << 0;
    return 0;
  }
  solve();
}
