#include <fstream>
#include <vector>
#include <cstring>
#include <stack>
#include <iostream>
#include <algorithm>
using namespace std;
ifstream fin("biconex.in");
ofstream fout("biconex.out");
int n, m;
int nivel[100005], low[100005];
bool v[100005];
vector<int> g[100005];
stack<pair<int, int> > st;
vector<vector<int> > bi;
void citire() {
fin >> n >> m;
while(m--) {
int x, y;
fin >> x>> y;
g[x].push_back(y);
g[y].push_back(x);
}
}
void add(int x, int y) {
cout << x << ' ' << y << '\n';
vector<int> c;
pair<int, int> p;
do {
p = st.top();
st.pop();
c.push_back(p.first);
c.push_back(p.second);
} while(p.first != x || p.second != y);
sort(c.begin(), c.end());
bi.push_back(c);
}
void dfs(int x, int t) {
v[x] = 1;
nivel[x] = low[x] = nivel[t]+1;
for(auto next: g[x]) {
if(!v[next]) {
st.push({x, next});
dfs(next, x);
if(low[next] >= nivel[x])
add(x, next);
low[x] = min(low[x], low[next]);
} else if(next != t)
low[x] = min(low[x], nivel[next]);
}
}
void solve() {
for(int i = 1; i <= n; i++)
if(!v[i])
dfs(i, 0);
}
void afis() {
fout << bi.size() << '\n';
for(auto a: bi) {
for(int i = 0; i < a.size(); i++)
if(a[i] != a[i+1] || (i == a.size()-1 && a[i] != a[i-1]))
fout << a[i] << ' ';
fout << '\n';
}
}
int main() {
citire();
solve();
afis();
}