#include"testlib.h"
#include<bits/stdc++.h>
#define all(v) v.begin(), v.end()

using namespace std;

const int T = 1e4;
const int MAX_N = 2e5;
const int MAX_Q = 2e5;

int32_t main(int argc, char *argv[]) {
    registerGen(argc, argv, 1);
    int n = opt<int>(1), swaps = opt<int>(2);
    int t = MAX_N / n;
    int q = MAX_Q / t;
    cout << t << '\n';
    for (int i = 0; i < t; ++i) {
        cout << n << ' ' << q << '\n';
        vector<int> a(n);
        iota(all(a), 1);
        reverse(all(a));
        for (int k = 0; k < swaps; ++k) {
            int index = rnd.next(0, n - 2);
            swap(a[index], a[index + 1]);
        }
        for (int x : a) cout <<  x << " \n"[x == a.back()];
        for (int i = 0; i < q; ++i) {
            int l = rnd.next(1, n);
            int r = rnd.next(1, n);
            cout << min(l, r) << ' ' << max(l, r) << '\n';
        }
    }
}
