#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int m, n, i, j, p, q, r, s, t, x, y, z, v, k, l, cost, h;
  cin >> t;
  for (i = 0; i < t; i++) {
    cin >> n;
    cout << n - 1 << endl;
    for (j = 1; j < n; j++) cout << j + 1 << " ";
    cout << endl;
  }
  return 0;
}
