#include <bits/stdc++.h>
#define FOR(i,start,end,jump) for(int i=(start),_end=(end);i<=_end;i+=(jump))
#define fi first
#define se second
#define ps(any) push_back(any)
using namespace std;
const int maxn = 2003;
int n, m, x, y, k;
vector<vector<int>> a;
bool visited[maxn], isused[maxn][maxn];
vector<int> res[maxn], tam;
void READ(){
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin>>n>>m;
a.resize(n+1);
FOR(i,1,m,1){
cin>>x>>y;
a[x].ps(y);
a[y].ps(x);
}
// FOR(i,1,n,1) sort(a[i].begin(),a[i].end());
}
bool dfs(int v,int p)
{
visited[v] = true;
tam.ps(v);
for(int j:a[v]){
if(j != p){
if(!visited[j]){
dfs(j,v);
}
else{
int cnt = 0;
if(!isused[v][j]){
cnt++;
isused[v][j] = isused[j][v] = true;
}
int temp = tam.back();
for(int t = tam.size()-2;t>=0;t--){
if(!isused[temp][tam[t]]) cnt++;
isused[temp][tam[t]] = isused[tam[t]][temp] = true;
temp = tam[t];
}
if(cnt>0)
{
k++;
res[k].ps(j);
for(int t=tam.size()-1;t>=0 && tam[t]!=j; t--) res[k].ps(tam[t]);
res[k].ps(j);
}
}
}
}
visited[v] = false;
tam.pop_back();
}
void DO(){
FOR(i,1,n,1){
dfs(i,0);
}
cout<<k<<'\n';
FOR(i,1,k,1){
for(int j = res[i].size()-1;j>=0;j--) cout<<res[i][j]<<" ";
cout<<'\n';
}
}
int main()
{
READ();
DO();
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNkZWZpbmUgRk9SKGksc3RhcnQsZW5kLGp1bXApIGZvcihpbnQgaT0oc3RhcnQpLF9lbmQ9KGVuZCk7aTw9X2VuZDtpKz0oanVtcCkpCiNkZWZpbmUgZmkgZmlyc3QKI2RlZmluZSBzZSBzZWNvbmQKI2RlZmluZSBwcyhhbnkpIHB1c2hfYmFjayhhbnkpCnVzaW5nIG5hbWVzcGFjZSBzdGQ7Cgpjb25zdCBpbnQgbWF4biA9IDIwMDM7CgppbnQgbiwgbSwgeCwgeSwgazsKdmVjdG9yPHZlY3RvcjxpbnQ+PiBhOwpib29sIHZpc2l0ZWRbbWF4bl0sIGlzdXNlZFttYXhuXVttYXhuXTsKdmVjdG9yPGludD4gcmVzW21heG5dLCB0YW07Cgp2b2lkIFJFQUQoKXsKICAgIGlvc19iYXNlOjpzeW5jX3dpdGhfc3RkaW8oMCk7Y2luLnRpZSgwKTtjb3V0LnRpZSgwKTsKICAgIGNpbj4+bj4+bTsKICAgIGEucmVzaXplKG4rMSk7CiAgICBGT1IoaSwxLG0sMSl7CiAgICAgICAgY2luPj54Pj55OwogICAgICAgIGFbeF0ucHMoeSk7CiAgICAgICAgYVt5XS5wcyh4KTsKICAgIH0KLy8gICAgRk9SKGksMSxuLDEpIHNvcnQoYVtpXS5iZWdpbigpLGFbaV0uZW5kKCkpOwp9Cgpib29sIGRmcyhpbnQgdixpbnQgcCkKewogICAgdmlzaXRlZFt2XSA9IHRydWU7CiAgICB0YW0ucHModik7CiAgICBmb3IoaW50IGo6YVt2XSl7CiAgICAgICAgaWYoaiAhPSBwKXsKICAgICAgICAgICAgaWYoIXZpc2l0ZWRbal0pewogICAgICAgICAgICAgICAgZGZzKGosdik7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgZWxzZXsKICAgICAgICAgICAgICAgIGludCBjbnQgPSAwOwogICAgICAgICAgICAgICAgaWYoIWlzdXNlZFt2XVtqXSl7CiAgICAgICAgICAgICAgICAgICAgY250Kys7CiAgICAgICAgICAgICAgICAgICAgaXN1c2VkW3ZdW2pdID0gaXN1c2VkW2pdW3ZdID0gdHJ1ZTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGludCB0ZW1wID0gdGFtLmJhY2soKTsKICAgICAgICAgICAgICAgIGZvcihpbnQgdCA9IHRhbS5zaXplKCktMjt0Pj0wO3QtLSl7CiAgICAgICAgICAgICAgICAgICAgaWYoIWlzdXNlZFt0ZW1wXVt0YW1bdF1dKSBjbnQrKzsKICAgICAgICAgICAgICAgICAgICBpc3VzZWRbdGVtcF1bdGFtW3RdXSA9IGlzdXNlZFt0YW1bdF1dW3RlbXBdID0gdHJ1ZTsKICAgICAgICAgICAgICAgICAgICB0ZW1wID0gdGFtW3RdOwogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgaWYoY250PjApCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgaysrOwogICAgICAgICAgICAgICAgICAgIHJlc1trXS5wcyhqKTsKICAgICAgICAgICAgICAgICAgICBmb3IoaW50IHQ9dGFtLnNpemUoKS0xO3Q+PTAgJiYgdGFtW3RdIT1qOyB0LS0pIHJlc1trXS5wcyh0YW1bdF0pOwogICAgICAgICAgICAgICAgICAgIHJlc1trXS5wcyhqKTsKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgIH0KICAgIH0KICAgIHZpc2l0ZWRbdl0gPSBmYWxzZTsKICAgIHRhbS5wb3BfYmFjaygpOwp9CnZvaWQgRE8oKXsKICAgIEZPUihpLDEsbiwxKXsKICAgICAgICBkZnMoaSwwKTsKICAgIH0KICAgIGNvdXQ8PGs8PCdcbic7CiAgICBGT1IoaSwxLGssMSl7CiAgICAgICAgZm9yKGludCBqID0gcmVzW2ldLnNpemUoKS0xO2o+PTA7ai0tKSBjb3V0PDxyZXNbaV1bal08PCIgIjsKICAgICAgICBjb3V0PDwnXG4nOwogICAgfQp9CgppbnQgbWFpbigpCnsKICAgIFJFQUQoKTsKICAgIERPKCk7Cn0K