#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
void c_p_c() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
bool is_pallindrome(string str, long long left, long long right) {
  if (left > right) return true;
  return (str[left] == str[right] && is_pallindrome(str, left + 1, right - 1));
}
long long convertToInt(string str) {
  long long sum = 0;
  long long power = 1;
  for (long long i = str.length() - 1; i >= 0; i--) {
    long long val = str[i] - '0';
    long long prod = ((val % 1000000007) * (power % 1000000007)) % 1000000007;
    sum = ((sum % 1000000007) + prod % 1000000007) % 1000000007;
    power *= 10;
  }
  return sum;
}
int32_t main() {
  c_p_c();
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    cout << n << endl;
    for (long long i = 1; i <= n; i++) cout << i << " ";
    cout << "\n";
  }
  return 0;
}
