#include <iostream>
#include <vector>
#include <algorithm>
#define nmax 1005
#define mod 66013
using namespace std;

vector <int> H[mod];
vector <pair <int, int> > sol;
int n, m, x, y, encoded;
pair <int, int> decoded;

int encode(int x, int y) { return (x<<12) + y; }
pair <int, int> decode(int t) { return make_pair(t>>12, t-((t>>12)<<12)); }


int main() {
	cin>>n>>m;
	for(int i=1; i<=m; i++) {
		cin>>x>>y;
		if(x > y) swap(x, y);

		encoded = encode(x, y);
		decoded = decode(encoded);
		int pos = encoded % mod;

		bool exists = false;
		for(int j=0; j<int(H[pos].size()); j++) 
			if(H[pos][j] == encoded) exists = true;

		if(exists) sol.push_back(decoded);
		else H[pos].push_back(encoded);
	}

	cout<<sol.size()<<"\n";
	for(int i=0; i<int(sol.size()); i++) cout<<sol[i].first<<" "<<sol[i].second<<"\n";

	return 0;
}