#include <bits/stdc++.h>
#pragma warning(disable : 6385 6386 6031)
const long double eps = 1e-5;
const int MOD = 1000000007;
using namespace std;
const int N = 1111;
int t, n;
int main() {
  scanf("%d", &t);
  for (int test = 0; test < t; ++test) {
    scanf("%d", &n);
    printf("%d\n", n);
    for (int i = 0; i < n; ++i) {
      printf("%d ", i + 1);
    }
    printf("\n");
  }
  return 0;
}
