#include "bits/stdc++.h" using namespace std; #define int long long #define ld long double #define ll long long #define st first #define nd second #define pb push_back #define eb emplace_back #define sz(x) (int)(x).size() #define all(x) begin(x),end(x) #define FOR(i,l,r) for(int i = (l); i <= (r); i++) #define ROF(i,r,l) for (int i = (r); i >= (l); i--) auto& operator<<(auto&o, pair<auto,auto>p) { return o << "(" << p.st << ", " << p.nd << ")"; } auto operator<<(auto&o, auto x)->decltype(end(x), o) { o << "{"; int i =0; for (auto e : x) o << ","+!i++ << e; return o << "}"; } #ifdef LOCAL #define debug(x...) cerr << "[" #x "]: ", [](auto...$) { \ ((cerr << $ << "; "), ...) << endl; }(x) #else #define debug() {} #endif #define rep(i, a, b) for (int i = (a); i < (b); i++) using pii = pair<int, int>; using vi = vector<int>; const int inf = 1e9 + 7; const int N = 55; int n, m; vector<pii> adj; int a, b; vector<vector<int>> ans; vector<int> vec; bool vis[N]; signed main() { cin.tie(0)->sync_with_stdio(0); cin >> n >> m; for(int i=0;i<m;i++){ cin >> a >> b; fill(vis,vis+n+1,0); vec.clear(); vec.push_back(a); vec.push_back(b); vis[a] = 1; vis[b] = 1; for(int i=1;i<=n;i++){ if(!vis[i]){ vis[i] = 1; vec.push_back(i); } } ans.push_back(vec); swap(vec[0],vec[1]); reverse(vec.begin(),vec.end()); ans.push_back(vec); } cout << ans.size() << "\n"; for(auto vec : ans){ for(auto v : vec){ cout << v << " "; } cout << "\n"; } return 0; }