#include <bits/stdc++.h>
using namespace std;
void Solve() {
  int n;
  cin >> n;
  cout << n << endl;
  for (int i = n - 1; i >= 0; --i) {
    cout << n - i << " ";
  }
  cout << endl;
}
int main() {
  ios::sync_with_stdio(NULL);
  cin.tie(NULL);
  cout.tie(NULL);
  int t;
  cin >> t;
  while (t--) Solve();
  return 0;
}
