#include <bits/stdc++.h>
using namespace std;
mt19937 e(chrono::steady_clock::now().time_since_epoch().count());
inline int rnd(int l,int r) {return uniform_int_distribution<int>(l,r)(e);}
int n,m,kk;
int main ()
{
    freopen("meow.in","w",stdout);
    ios::sync_with_stdio(false);
    int T = 1000;cout << T << '\n';
    while (T--)
    {
        int n = rnd(3,3),kk = n * 2 - 1;
        vector<int> a;int m = rnd(10,20);set<int> st;
        while (m--)
        {
            int x = rnd(1,kk);if (st.count(x)) st.erase(x);else st.insert(x);
            a.push_back(x);
        }
        vector<int> tt(st.begin(),st.end());shuffle(tt.begin(),tt.end(),e);
        for (auto &i : tt) a.push_back(i);
        cout << n << ' ' << a.size() << ' ' << kk << '\n';
        for (auto &i : a) cout << i << ' ';
        cout << '\n';
    }
    return 0;
}