#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, n, temp, m, i, j, k;
  cin >> t;
  while (t--) {
    cin >> n;
    int arr[n];
    for (i = 0; i < n; i++) arr[i] = i + 1;
    m = n;
    int values[m];
    for (j = 0; j < m; j++) {
      temp = arr[j];
      for (k = 0; k < n; k++) {
        if (k != j) arr[k] = arr[k] + j + 1;
      }
      values[j] = j + 1;
    }
    cout << m << endl;
    for (i = 0; i < m; i++) cout << values[i] << " ";
    cout << endl;
  }
  return 0;
}
