#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 500100, mod = 998244353;
int n, tt, m;
void fn() {
  cin >> n;
  cout << n - 1 << endl;
  for (int i = 2; i <= n; i++) {
    cout << i << " ";
  }
  cout << endl;
  return;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  ;
  cin >> tt;
  while (tt--) fn();
  return 0;
}
