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

int n, m, answer=-1;
int a[100002][2];
vector <pair <int, int > > v;

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;
}

void func (int deca_left, int arr[]) {
    //cout << "now " << deca_left << " ";
    //for (int i=1; i <= m; i++) {cout << arr[i] << " ";}
    //cout << endl;
    for (int i=1; i <= m; i++) {
        if (arr[i] != 0) {continue;}
        for (int j=i+1; j <= m; j++) {
            if (arr[j] != 0) {continue;}
            if (obshto (i, j) == false) {continue;}
            arr[i] = deca_left;
            arr[j] = deca_left;
            func (deca_left - 2, arr);
            arr[i] = 0;
            arr[j] = 0;
        }
    }
    if (answer < m - deca_left) {
        answer = m-deca_left;
        v.clear();
        for (int i=1; i <= m; i++) {
            for (int j=i+1; j <= m; j++) {
                if (arr[i] == arr[j]) {
                    v.push_back({i, j});
                }
            }
        }
    }
    return;
}

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];
}

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

func (m, x);

cout << answer/2 << endl;

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

return 0;
}