#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using db = double;
using str = string;
using ull = unsigned long long;
using uint = unsigned int;
using pi = pair<int, int>;
using pl = pair<ll, ll>;
using pd = pair<db, db>;
const int dx[] = {1, -1, 0, 0, 1, 1, -1, -1};
const int dy[] = {0, 0, 1, -1, 1, -1, 1, -1};
const ll N = 5e5 + 7, inf = 1e9 + 7, mod = 1e9 + 7, linf = 1e18 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    cout << n - 1 << '\n';
    for (int i = 2; i <= n; i += 1) {
      cout << i << ' ';
    }
    cout << '\n';
  }
  return 0;
}
