#include <cstdio>
#include <vector>
#include <algorithm>

using namespace std;

#define forn(i, n) for (int i = 0; i < (int)(n); i++)

#define forn(i, n) for (int i = 0; i < (int)(n); i++)


#define pb push_back

const int N = (int)1e5;
int n, m, curT, u[N], t[N], mt[N];
vector <int> c[N];

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

void dfs( int v, int p = -1 )
{
  u[v] = 1;
  mt[v] = t[v] = curT++;
  forn(i, c[v].size())
  {
    int x = c[v][i];
    if (x != p)
    {
      if (!u[x])
      {
        dfs(x, v);
        if (mt[x] > t[v]) 
          add(v, x);
      }
      mt[v] = min(mt[v], mt[x]);
    }
  }
}

int main()
{
  scanf("%d%d", &n, &m);
  while (m--)
  {
    int a, b;
    scanf("%d%d", &a, &b), a--, b--;
    c[a].pb(b);
    c[b].pb(a);
  }
  dfs(0);

  printf("%d\n", rn);
  sort(r, r + rn);
  forn(i, rn)
    printf("%d %d\n", r[i].first, r[i].second);
  return 0;
}