#include <bits/stdc++.h>
#define endl "\n"
#define INT long long int

using namespace std;

char infile[100], outfile[100];

int main() {
    ios::sync_with_stdio(false);
    INT T,a, b, n, t, i, I;
    cin >> T;
    for(I=1;I<=T;I++){
        sprintf(infile, ".%d.in", I);
        freopen(infile, "w", stdout);
        scanf("%lld",&n);
        printf("%lld\n", n);
        for(i=0;i<n;i++){
            printf("%lld ", n);
        }

        sprintf(outfile, ".%d.out", I);
        freopen(outfile, "w", stdout);
        printf("%lld\n", n);
    }
    for(I=T+1;I<=T*2;I++){
        sprintf(infile, ".%d.in", I);
        freopen(infile, "w", stdout);
        scanf("%lld",&n);
        printf("%lld\n", n);
        for(i=0;i<n;i++){
            printf("%lld ", (rand()*100+rand())%n+1);
        }
        sprintf(outfile, ".%d.out", I);
        freopen(outfile, "w", stdout);
        printf("1\n");
    }
    for(I=T*2+1;I<=T*3;I++){
        sprintf(infile, ".%d.in", I);
        freopen(infile, "w", stdout);
        scanf("%lld",&n);
        printf("%lld\n", n);
        int c = rand()%n+1;
        for(i=0;i<n;i++){
            if(i!=c) printf("%lld ", n/2+1);
            else printf("%lld ", n);
        }
        sprintf(outfile, ".%d.out", I);
        freopen(outfile, "w", stdout);
        printf("1\n");
    }
}
