#include<bits/stdc++.h>
using namespace std;
int main(){
    freopen("meow.in","w",stdout);
    ios::sync_with_stdio(false);
    mt19937 s(chrono::steady_clock::now().time_since_epoch().count());
    int T=s()%5+1;
    cout<<T<<'\n';
    while (T--){
        int n=s()%20+1,k=2*n-1-s()%2;
        vector<int> vec;
        for (int i=1;i<=n;i++){
            int t=(s()%8+1)*2;
            while (t--) vec.push_back(i);
        }
        shuffle(vec.begin(),vec.end(),s);
        cout<<n<<' '<<vec.size()<<' '<<k<<'\n';
        for (int v:vec) cout<<v<<' ';
        cout<<'\n';
    }
    return 0;
}