#include <bits/stdc++.h>
using namespace std;
bool sort1(const pair<long long, pair<long long, long long>>& a1,
           const pair<long long, pair<long long, long long>>& b1) {
  if (a1.second.first == b1.second.first)
    return a1.first < b1.first;
  else
    return a1.second.first < b1.second.first;
}
signed main() {
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    cout << n - 1 << endl;
    for (long long i = 2; i <= n; i++) cout << i << " ";
    cout << endl;
  }
}
