#include <bits/stdc++.h>
using namespace std;
int nn, m;
vector<pair<int, int> > edg;
struct edge {
  int from, to, cap, flow;
};
int INF = INT_MAX;
struct Dinics {
  vector<int> cur, d;
  vector<vector<int> > adj;
  vector<edge> e;
  int source, sink, n;
  Dinics() {}
  Dinics(int v) {
    n = v;
    cur.resize(n + 10);
    d.resize(n + 10);
    adj.resize(n + 10);
  }
  void addEdge(int from, int to, int cap, int flow) {
    edge e1 = {from, to, cap, flow};
    edge e2 = {to, from, 0, 0};
    adj[from].push_back(e.size());
    e.push_back(e1);
    adj[to].push_back(e.size());
    e.push_back(e2);
  }
  bool bfs() {
    queue<int> q;
    for (int i = 0; i < n + 1; i++) d[i] = -1;
    q.push(source);
    d[source] = 0;
    while (!q.empty() and d[sink] < 0) {
      int cur = q.front();
      q.pop();
      for (int i = 0; i < adj[cur].size(); i++) {
        int id = adj[cur][i];
        int to = e[id].to;
        if (d[to] < 0 and e[id].flow < e[id].cap) {
          q.push(to);
          d[to] = d[cur] + 1;
        }
      }
    }
    return (d[sink] >= 0);
  }
  int dfs(int x, int flow) {
    if (!flow) return 0;
    if (x == sink) return flow;
    for (; cur[x] < (int)adj[x].size(); ++cur[x]) {
      int id = adj[x][cur[x]], to = e[id].to;
      if (d[to] != d[x] + 1) continue;
      int pushed = dfs(to, min(flow, e[id].cap - e[id].flow));
      if (pushed) {
        e[id].flow += pushed;
        e[id ^ 1].flow -= pushed;
        return pushed;
      }
    }
    return 0;
  }
  int maxflow(int source, int sink) {
    this->source = source;
    this->sink = sink;
    int flow = 0;
    while (bfs()) {
      for (int i = 0; i <= n; ++i) cur[i] = 0;
      while (int pushed = dfs(source, INF)) {
        flow += pushed;
      }
    }
    return flow;
  }
  void recover() {
    for (int i = 0; i < e.size(); i++) {
      if (e[i].cap == 0 or e[i].from == source or e[i].to == sink) continue;
      if (e[i].to >= nn + 1 && e[i].to <= nn + m && e[i].flow != 0) {
        int a = e[i].from;
        int b = edg[e[i].to - nn - 1].first;
        if (b == a) b = edg[e[i].to - nn - 1].second;
        cout << a << " " << b << "\n";
      }
    }
  }
};
bool pos(int x, bool param) {
  Dinics solver(10005);
  for (int i = 1; i <= nn; i++) {
    solver.addEdge(0, i, x, 0);
  }
  for (int i = 1; i <= nn; i++) {
    for (int j = 1; j <= m; j++) {
      if (edg[j - 1].first == i || edg[j - 1].second == i) {
        solver.addEdge(i, j + nn, 1, 0);
      }
    }
  }
  for (int j = 1; j <= m; j++) solver.addEdge(j + nn, nn + m + 1, 1, 0);
  if (solver.maxflow(0, nn + m + 1) == m) {
    if (param) solver.recover();
    return true;
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  int precision = numeric_limits<double>::digits10;
  cin >> nn >> m;
  for (int i = 1; i <= m; i++) {
    int u, v;
    cin >> u >> v;
    edg.push_back(make_pair(u, v));
  }
  if (m == 0)
    cout << 0 << "\n";
  else {
    int lo = 1, hi = m;
    while (lo < hi) {
      int mid = (lo + hi) >> 1;
      if (pos(mid, false))
        hi = mid;
      else
        lo = mid + 1;
    }
    cout << lo << "\n";
    pos(lo, true);
  }
}
