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