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