#include<bits/stdc++.h>
using namespace std ;
const int N = 105 ;
int n , m , par[N] , leaf[N] , cnt ;
vector<int> nei[N] , child[N] ;
void buildTree(int node){
for(int i:nei[node]){
if(par[node]==i) continue ;
par[i]=node ; child[node].push_back(i) ;
buildTree(i) ;
}
if(child[node].empty()) leaf[node]=1 , cnt++ ;
}
void dfs(int node){
if(leaf[node]) return ;
for(int i:child[node]) dfs(i) ;
// par[node] , node , child[node] color 0
// else color 1
vector<int> v ;
v.push_back(node) ;
for(int i:nei[node]) v.push_back(i) ;
sort(v.begin(),v.end()) ;
for(int i=0 ; i<n ; i++){
if(binary_search(v.begin(),v.end(),i)) cout << "0 " ;
else cout << i << ' ' ;
}
cout << '\n' ;
int temp = par[node] ;
if(temp==-1) temp = nei[node][0] ;
for(int i=0 ; i<n ; i++){
if(i==node || i==temp) cout << "0 " ;
else cout << i << ' ' ;
}
cout << '\n' ;
for(int i=0 ; i<n ; i++){
if(binary_search(v.begin(),v.end(),i)) cout << "0 " ;
else cout << i << ' ' ;
}
cout << '\n' ;
}
int main(){
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0) ;
cin >> n >> m ;
for(int i=0 ; i<m ; i++){
int a , b ; cin >> a >> b ;
nei[a].push_back(b) ; nei[b].push_back(a) ;
}
memset(par,-1,sizeof(par)) ;
buildTree(0) ;
cout << 3*(n-cnt) << '\n' ;
dfs(0) ;
return 0 ;
}