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