#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e6;
bool ar[MAX + 1];
vector<int> listOfPrime;
void sieve() {
  memset(ar, true, sizeof ar);
  ar[0] = ar[1] = false;
  for (int i = 2; i * i <= MAX; i++)
    if (ar[i])
      for (int j = i * i; j <= MAX; j += i) ar[j] = false;
  for (int i = 0; i <= MAX; i++)
    if (ar[i]) listOfPrime.push_back(i);
}
void solve() {
  int n;
  cin >> n;
  if (n <= 2)
    cout << 1 << endl << n << endl;
  else {
    cout << n << endl;
    int val = 0;
    for (int i = 0; i < n; i++) cout << ++val << " ";
    cout << endl;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  sieve();
  int tt;
  cin >> tt;
  while (tt--) solve();
  return 0;
}
