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

#define rep(i,a,b) for(int i = a; i < b; i++)
typedef long long ll;


int main() {
    int n, m;
    cin >> n >> m;

    vector<vector<int>> ans;

    rep(i,0,m) {
        int a, b; 
        cin >> a >> b;
        a--;
        b--;
        vector<int> here, here2;
        rep(i,0,n) if (i != a && i != b) {
            here.push_back(i);
            here2.push_back(i);
        }        
        reverse(here2.begin(), here2.end());
        here.push_back(a);
        here.push_back(b);
        here2.push_back(a);
        here2.push_back(b);
        ans.push_back(here);
        ans.push_back(here2);
    }

    cout << ans.size() << endl;
    for (auto l: ans) {
        for (auto x : l) cout << x+1 << " ";
        cout << endl;
    }
}