#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n;
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &n);
    printf("%d\n", n - 1);
    for (int i = 2; i <= n; ++i) printf("%d ", i);
    printf("\n");
  }
}
