#include <cassert>
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
#define pb push_back
#define forn(i, n) for (int i = 0; i < (int)(n); i++)
const int N = (int)1e5;
const int M = (int)1e6;
int n, m, u[N], a[M], b[M];
vector <int> c[N];
void dfs( int v, int cc )
{
u[v] = cc;
forn(i, c[v].size())
if (!u[c[v][i]])
dfs(c[v][i], cc);
}
int solve( int ind )
{
forn(i, n)
c[i].clear();
forn(i, m)
if (i != ind)
c[a[i]].pb(b[i]), c[b[i]].pb(a[i]);
forn(i, n)
u[i] = 0;
int cc = 0;
forn(i, n)
if (!u[i])
cc++, dfs(i, cc);
return cc;
}
typedef pair <int, int> pii;
pii r[N];
int rn;
void add( int v, int w )
{
r[rn++] = pii(min(v, w), max(v, w));
}
int main()
{
scanf("%d%d", &n, &m);
assert(n <= N);
assert(m <= M);
forn(i, m)
scanf("%d%d", &a[i], &b[i]), a[i]--, b[i]--;
int cc = solve(-1);
forn(i, m)
if (cc != solve(i))
add(a[i], b[i]);
printf("%d\n", rn);
sort(r, r + rn);
forn(i, rn)
printf("%d %d\n", r[i].first, r[i].second);
return 0;
}