#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    long int n, i, j, k, temp, ans;
    cin >> n;
    cout << n - 1;
    cout << endl;
    for (i = 2; i <= n; i++) cout << i << " ";
    cout << endl;
  }
}
