#include <bits/stdc++.h>
using namespace std;

int n, m;
int a[100002][2];
vector <int> nbs[5002];
vector <pair <int, int> > v;
bool used[5006];

bool obshto (int x, int y) {
    if (a[x][0] == a[y][0] or a[x][0] == a[y][1] or a[x][1] == a[y][0] or a[x][1] == a[y][1]) {return true;}
    return false;
}

bool speaks (int x, int y) {
    if (a[x][0] == y or a[x][1] == y) {return true;}
    return false;
}

int main () {
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);

cin >> n >> m;

for (int i=1; i <= m; i++) {
    cin >> a[i][0] >> a[i][1];
}

for (int i=1; i <= m; i++) {
    for (int j=i+1; j <= m; j++) {
        if (obshto (i, j) == true) {
            nbs[i].push_back(j);
            nbs[j].push_back(i);
        }
    }
}

for (int i=1; i <= m; i++) {
    if (used[i] == true) {continue;}
    if (nbs[i].size() == 1 and used[nbs[i][0]] == false) {
        v.push_back({i, nbs[i][0]});
        used[i] = true;
        used[nbs[i][0]] = true;
    }
}

for (int i=1; i <= m; i++) {
    if (used[i] == true) {continue;}
    if (nbs[i].size() == 2) {
        int currn1 = nbs[i][0], currn2 = nbs[i][1];
        if (used[currn1] == false) {
            v.push_back({i, currn1});
            used[i] = true;
            used[currn1] = true;
        }
        else if (used[currn2] == false) {
            v.push_back({i, currn2});
            used[i] = true;
            used[currn2] = true;
        }
    }
}

cout << v.size() << endl;

for (int i=0; i < v.size(); i++) {
    cout << v[i].first << " " << v[i].second << endl;
}

return 0;
}