#include<bits/stdc++.h>
using namespace std;
vector<pair<int, int>> ans;
vector<int> cv[1000000];
bool uc[1000000];
int  main() {
    long long n, m;
    cin >> m >> n;
    for(int i = 0 ; i < n; i++){
        int a1, b1;
        cin >> a1 >> b1;
        cv[a1].push_back(i + 1);
        cv[b1].push_back(i + 1);
    }
    cout << n / 2 << "\n";
    for(int i = 1; i <= m ; i++){
        //cout << cv[i].size() << "\n";
        if(cv[i].size() > 0){
            int curr = -1;
            for(int j = 0; j < cv[i].size(); j++){
                if(!uc[cv[i][j]]){

                    if(curr == -1){
                        curr = cv[i][j];
                    }else{
                        uc[cv[i][j]] = true;
                        uc[curr] = true;
                        cout << curr << " " << cv[i][j] << "\n";
                        curr = -1;
                    }
                }
            }
        }
    }
    //cout << n%2 << "\n";



    return 0;
}

