#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n;
  cin >> t;
  for (int i = 0; i < t; i++) {
    cin >> n;
    cout << n << endl;
    for (int j = 1; j <= n; j++) {
      cout << j << " ";
    }
    cout << endl;
  }
  return 0;
}
