#include <bits/stdc++.h>
#define endl '\n'
using namespace std;

const int MAXN = 1e6+6;
vector <int> G[MAXN];

bool used[MAXN];

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

    int n, m;
    cin >> n >> m;
    for (int i = 0; i < m; i++)
    {
        int a, b;
        cin >> a >> b;
        G[i].push_back(a);
        G[i].push_back(b);
    }

    cerr << "===" << endl;

    cout << m / 2 << endl;

    int br = 0;
    for (int i = 1; i <= n; i++)
    {
        for (int j = 0; j < G[i].size(); j++)
        {
            if (used[G[i][j]]) continue;
            used[G[i][j]] = 1;
            cout << G[i][j] << " ";
            br++;
            if (br % 2 == 0) cout << endl;
        }
    }

    return 0;
}
/***

10 15
4 9
9 5
4 6
6 8
10 1
1 4
3 1
3 9
5 6
5 2
2 7
3 7
10 8
2 10
7 8

------

7
2 9
1 6
3 4
7 5
10 14
13 15
11 12

*/

