#include <bits/stdc++.h>
constexpr auto MAX_BIT_INT = 31;
constexpr auto MOD = 1000000007;
constexpr auto INF = 1000000007;
using namespace std;
int T, n;
int main() {
  cin >> T;
  while (T) {
    T--;
    cin >> n;
    cout << n - 1 << endl;
    for (int i = 2; i <= n; i++) {
      cout << i << ' ';
    }
    cout << endl;
  }
}
