#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout << fixed;
  cout.precision(10);
  int T = 1;
  cin >> T;
  while (T--) {
    int n;
    cin >> n;
    cout << n << "\n";
    for (int i = 1; i <= n; i++) {
      cout << i << " ";
    }
    cout << "\n";
  }
  return 0;
}
