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