#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int TC;
  cin >> TC;
  while (TC--) {
    int n;
    cin >> n;
    cout << n << "\n";
    for (int i = 1; i <= n; i++) {
      cout << i << " ";
    }
    cout << "\n";
  }
}
