#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  int tc;
  cin >> tc;
  while (tc--) {
    int n;
    cin >> n;
    cout << n << endl;
    for (int i = 1; i <= n; i++) {
      cout << i << " ";
    }
    cout << endl;
  }
}
