#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long i, j, k, n, ans, t;
  cin >> t;
  i = 0;
  while (i < t) {
    cin >> n;
    cout << n << endl;
    j = 1;
    while (j <= n) {
      cout << j << " ";
      j++;
    }
    cout << endl;
    i++;
  }
  return (0);
}
