#include <iostream>
#include <vector>
using namespace std;
const int MAXN=1e5+10;
vector <int> col[MAXN], cur;
vector <pair <int,int> > room;
bool used[MAXN];
int main () {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n, m, a, b;
    cin >> n >> m;
    for (int i=0;i<m;i++) {
        cin >> a >> b;
        col[a].push_back(i+1);
        col[b].push_back(i+1);
    }
    for (int i=1;i<=n;i++) {
        if (!cur.empty()) cur.clear();
        for (int j=0;j<col[i].size();j++) {
            if (used[col[i][j]]) continue;
            cur.push_back(col[i][j]);
        }
        if (cur.size()<=1) continue;
        for (int j=0;j+1<cur.size();j+=2) {
            room.push_back({cur[j],cur[j+1]});
            used[cur[j]]=true;
            used[cur[j+1]]=true;
        }
    }
    cout << room.size() << endl;
    for (int i=0;i<room.size();i++) cout << room[i].first << ' ' << room[i].second << endl;
    return 0;
}
/**
7 6
1 2
2 3
3 1
4 5
5 6
6 7
**/
