#include "testlib.h"
#include <iostream>
using namespace std;

int h[12] = {2, 2, 2, 2, 2, 3, 3, 5, 5, 7, 7, 10};
 
int main(int argc, char* argv[]) {
    registerGen(argc, argv, 1);
 
    int n = atoi(argv[1]);
    if (n < 2) n = 2;
    int q = n;
    int X = atoi(argv[2]);
    vector<long long> a(n, 1);
    if (X == 1) {
        cout << n << endl;
        for (int i = 0; i < n; ++i) {
            cout << a[i];
            if (i == n - 1)
                cout << endl;
            else
                cout << " ";
        }
        cout << q << endl;
        while (q--) {
            int val = rnd.next(1, 5);
            if (val == 1) {
                cout << "1 " << rnd.next(2, 100000) << endl;
            }
            else if (val == 2) {
                cout << "2 " << rnd.next(2, 100000) << endl;
            }
            else {
                int l = rnd.next(1, n);
                int r = rnd.next(1, n);
                if (r < l) swap(l, r);
                cout << "3 " << l << " " << r << endl;
            }
        }
    }
    else {
        a[1] = X;
        for (int i = 2; i < n; ++i)
            a[i] = rnd.next(2, X);
        shuffle(a.begin(), a.end());
        cout << n << endl;
        for (int i = 0; i < n; ++i) {
            cout << a[i];
            if (i == n - 1)
                cout << endl;
            else
                cout << " ";
        }
        cout << q << endl;
        while (q--) {
            int val = rnd.next(1, 5);
            if (val == 1) {
                int k = h[rnd.next(0, 11)];
                if (k == 10) k = rnd.next(23, 100000);
                cout << "1 " << k << endl;
            }
            else if (val == 2) {
                int k = h[rnd.next(0, 11)];
                if (k == 10) k = rnd.next(23, 100000);
                cout << "2 " << k << endl;
            }
            else {
                int l = rnd.next(1, n);
                int r = rnd.next(1, n);
                if (r < l) swap(l, r);
                cout << "3 " << l << " " << r << endl;
            }
        }
    }
 
    return 0;
}



// 1 - 1    k_max = inf
// 1 - 2    k_max = 16
// 1 - 3    k_max = 10
// 1 - 5    k_max =  7
// 1 - 6    k_max =  6
// 1 - 315  k_max =  2
// 1 - 10^5 k_max =  1