Problem: Soon the first year students will be initiated into students at the University of Berland. The organizers of the initiation come up with a program for this holiday. In their opinion, it would be good if the first-year students presented small souvenirs to each other. When they voiced this idea to the first-year students, they found out the following:

  * some pairs of the new students already know each other; 
  * each new student agrees to give souvenirs only to those with whom they are already familiar; 
  * each new student does not want to present too many souvenirs. 



The organizers have written down all the pairs of first-year friends who are familiar with each other and now want to determine for each new student, whom they should give souvenirs to. In their opinion, in each pair of familiar students exactly one student must present a souvenir to another student.

First year students already decided to call the unluckiest the one who will have to present the greatest number of souvenirs. The organizers in return promised that the unluckiest will be unlucky to the minimum possible degree: of course, they will have to present the greatest number of souvenirs compared to the other students, but this number will be as small as possible.

Organizers are very busy, and they asked you to determine for each pair of first-year friends who and to whom should present a souvenir.

Input

The first line contains two integers n and m (1 ≤ n ≤ 5000, 0 ≤ m ≤ min(5000, n·(n - 1) / 2)) — the number of the first year students and the number of pairs of the students that know each other. The students are numbered from 1 to n.

Each of the following m lines contains two integers xi, yi (1 ≤ xi, yi ≤ n, xi ≠ yi) — the students in each pair.

It is guaranteed that each pair is present in the list exactly once. It is also guaranteed that if there is a pair (xi, yi) in the list, then there is no pair (yi, xi).

Output

Print a single integer into the first line — the smallest number of souvenirs that the unluckiest student will have to present.

Following should be m lines, each containing two integers — the students which are familiar with each other. The first number in the pair must be the student that will present the souvenir to the second student in the pair.

Pairs can be printed in any order. If there are many solutions, print any of them.

Examples

Input

5 4
2 1
1 3
2 3
2 5


Output

1
1 2
2 3
3 1
5 2


Input

4 3
1 2
1 3
1 4


Output

1
1 4
2 1
3 1


Input

4 6
1 2
4 1
4 2
3 2
4 3
1 3


Output

2
1 3
2 1
2 4
3 2
4 1
4 3

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
class Graph {
 public:
  Graph(int n) {
    _N = n;
    _G = vector<vector<int>>(n, vector<int>());
    _cap = vector<vector<char>>(n, vector<char>(n, 0));
  }
  void setSource(int source) { _source = source; }
  void setDest(int dest) { _dest = dest; }
  void addEdge(int x, int y, int cap, int cost = 0) {
    if (_cap[x][y]) {
      _cap[x][y] += cap;
      return;
    }
    _G[x].push_back(y);
    _G[y].push_back(x);
    _cap[x][y] = cap;
  }
  bool augmentingPath(vector<int> &d, vector<int> &dad) {
    queue<int> Q;
    Q.push(_source);
    d[_source] = 0;
    dad[_source] = _source;
    while (!Q.empty()) {
      int node = Q.front();
      Q.pop();
      for (auto temp : _G[node]) {
        if (_cap[node][temp] <= 0) continue;
        if (d[temp] > d[node]) {
          dad[temp] = node;
          d[temp] = d[node];
          Q.push(temp);
          if (temp == _dest) return true;
        }
      }
    }
    return (dad[_dest] != -1);
  }
  pair<int, int> minCostMaxFlow() {
    vector<int> dad(_N, -1);
    vector<int> d(_N, _COST_INF);
    int flow = 0;
    int flowcost = 0;
    while (augmentingPath(d, dad)) {
      char first = 1;
      for (int node = _dest; node != _source; node = dad[node])
        first = min(char(first), _cap[dad[node]][node]);
      for (int node = _dest; node != _source; node = dad[node]) {
        _cap[dad[node]][node] -= first;
        _cap[node][dad[node]] += first;
      }
      flow += first;
      flowcost += d[_dest];
      dad = vector<int>(_N, -1);
      d = vector<int>(_N, _COST_INF);
    }
    return make_pair(flow, flowcost);
  }
  int _N;
  vector<vector<int>> _G;
  vector<vector<char>> _cap;
  int _source, _dest;
  static const int _CAP_INF = (1 << 30);
  static const int _COST_INF = 2e9 + 5;
};
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> a(m, 0), b(m, 0);
  vector<vector<int>> g(n, vector<int>());
  for (int i = 0; i < m; ++i) {
    cin >> a[i] >> b[i];
    a[i] -= 1;
    b[i] -= 1;
    if (rand() % 2)
      g[a[i]].push_back(b[i]);
    else
      g[b[i]].push_back(a[i]);
  }
  int ans = 1e3;
  for (int it = 0; it < 10000; ++it) {
    int maxx = 0, who = -1;
    for (int i = 0; i < n; ++i) {
      if (int(g[i].size()) > maxx) {
        maxx = g[i].size();
        who = i;
      }
    }
    if (maxx == 0) {
      ans = 0;
      break;
    }
    ans = min(ans, maxx);
    random_shuffle(g[who].begin(), g[who].end());
    int where = g[who].back();
    g[who].pop_back();
    g[where].push_back(who);
  }
  int sol = -1;
  vector<pair<int, int>> ret;
  for (int lf = max(0, ans - 10), rt = ans; lf <= rt;) {
    int mid = (lf + rt) / 2;
    int NODES = m + n + 2;
    Graph G(NODES);
    G.setSource(m + n);
    G.setDest(m + n + 1);
    for (int i = 0; i < m; ++i) {
      G.addEdge(m + n, i, 1);
      G.addEdge(i, m + a[i], 1);
      G.addEdge(i, m + b[i], 1);
    }
    for (int i = 0; i < n; ++i) {
      G.addEdge(m + i, m + n + 1, mid);
    }
    auto ans = G.minCostMaxFlow();
    if (ans.first == m) {
      sol = mid;
      rt = mid - 1;
      vector<pair<int, int>> aux;
      for (int i = 0; i < m; ++i) {
        if (G._cap[i][m + a[i]] == 0) {
          aux.push_back(make_pair(a[i], b[i]));
        } else {
          aux.push_back(make_pair(b[i], a[i]));
        }
      }
      ret = aux;
    } else {
      lf = mid + 1;
    }
  }
  cout << sol << "\n";
  for (auto temp : ret)
    cout << temp.first + 1 << " " << temp.second + 1 << "\n";
}