#include <bits/stdc++.h>
using namespace std;
const long long int MOD = 1e9 + 7;
const long long int INF = 2e15;
const long long int MAXN = 1e5 + 5;
long long int fastexpo(long long int b, long long int exp) {
  if (exp == 0) return 1;
  if (exp == 1) return b;
  long long int ans = (fastexpo(b, exp / 2) % MOD);
  ans *= ans;
  ans %= MOD;
  if (exp % 2 == 1) {
    ans *= b;
  }
  ans %= MOD;
  return ans;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int t;
  cin >> t;
  while (t--) {
    long long int n;
    cin >> n;
    cout << n << endl;
    for (long long int i = 1; i <= n; i++) {
      cout << i << ' ';
    }
    cout << endl;
  }
  return 0;
}
