#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t;
  cin >> t;
  while (t--) {
    long long x;
    cin >> x;
    if (x == 2) {
      cout << 1 << "\n";
      cout << 2 << "\n";
    } else {
      cout << x << "\n";
      for (long long i = 1; i <= x; i++) {
        cout << i << " ";
      }
      cout << "\n";
    }
  }
  return 0;
}
