#include <bits/stdc++.h>
using namespace std;

int main(){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int n, m; cin >> n >> m;

    vector<vector<int>> ans;

    vector<pair<int,int>> edges;

    for(int i=0; i<m; i++){
        int a, b; cin >> a >> b;
        edges.push_back({a, b});
    }

    for(auto [a, b]: edges){
        vector<int> perm;
        perm.push_back(a);
        perm.push_back(b);

        for(int i=1; i<=n; i++){
            if(i != a and i != b) perm.push_back(i);
        }

        ans.push_back(perm);
        swap(perm[0], perm[1]);
        reverse(perm.begin(), perm.end());
        ans.push_back(perm);
    }

    cout << ans.size() << "\n";
    for(auto v: ans){
        for(auto x: v) cout << x << " ";
        cout << "\n";
    }
}