#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
const int MAXN=1e5+5;
const int MAXM=1e6+5;
const int INF=1e9+5;
struct Edge
{
    int cap,flow;
    Edge() {}
    Edge(int a,int b)
    {
        cap=a;
        flow=b;
    }
};
int n,m;
pair<int,int> a[MAXM];
vector<int> adj[MAXM];
Edge edge[11005][11005];
int max_flow=0;
bool used[11005];
int level[11005];
int fse[11005];
bool bfs(int s)
{
    queue<int> q;
    q.push(s);
    used[s]=1;
    while(!q.empty())
    {
        s=q.front();
        q.pop();
        for(int i=0;i<adj[s].size();i++)
        {
            int next=adj[s][i];
            if(used[next] || edge[s][next].cap-edge[s][next].flow<1) continue;
            level[next]=level[s]+1;
            used[next]=1;
            q.push(next);
        }
    }
    return level[10011]!=-1;
}
int dfs(int curr,int flow)
{
    if(flow==0) return 0;
    if(curr==10011) return flow;
    int next=-1,freeCap=0;
    for(; fse[curr]<adj[curr].size();fse[curr]++)
    {
        next=adj[curr][fse[curr]];
        freeCap=edge[curr][next].cap-edge[curr][next].flow;

        if(level[next]!=level[curr]+1 || freeCap<1) continue;
        int tr_flow=dfs(next,min(flow,freeCap));
        if(tr_flow==0) continue;
        edge[curr][next].flow+=tr_flow;
        edge[next][curr].flow-=tr_flow;
        return tr_flow;
    }
    return 0;
}
void Dinic()
{
    int curr_flow=0;
    while(1)
    {
        memset(used,0,sizeof(used));
        memset(level,-1,sizeof(level));
        if(!bfs(0)) break;
        memset(fse,0,sizeof(fse));
        curr_flow=dfs(0,INF);
        while(curr_flow)
        {
            if(max_flow>=m/2) return;
            max_flow+=curr_flow;
            curr_flow=dfs(0,INF);
        }
    }
}
int main()
{
//ios::sync_with_stdio(0);
//cin.tie(0);
//cout.tie(0);
cin>>n>>m;
for(int i=1;i<=m;i++)
{
    //cout<<i<<": ";
    cin>>a[i].first>>a[i].second;
    adj[0].push_back(i);
    adj[i].push_back(0);
    edge[0][i].cap=1;
    edge[0][i].flow=0;
    edge[i][0].cap=0;
    adj[i+m].push_back(10011);
    adj[10011].push_back(i+m);
    edge[i+m][10011].cap=1;
    edge[i+m][10011].flow=0;
    edge[10011][i+m].cap=0;
}
for(int i=1;i<m;i++)
{
    for(int j=i+1;j<=m;j++)
    {
        if(a[i].first==a[j].first || a[i].first==a[j].second ||
           a[i].second==a[j].first || a[i].second==a[j].second)
        {
            //cout<<i<<" "<<j<<endl;
            adj[i].push_back(j+m);
            adj[j+m].push_back(i);
            edge[i][j+m].cap=1;
            edge[i][j+m].flow=0;
            edge[j+m][i].cap=0;
        }
    }
}
Dinic();
cout<<max_flow<<endl;
for(int i=1;i<m;i++)
{
    for(int j=i+1+m;j<=m+m;j++)
    {
        if(edge[i][j].cap>0 && edge[i][j].flow==1) cout<<i<<" "<<j-m<<endl;
    }
}
return 0;
}
