#include <bits/stdc++.h>
using namespace std;
int bPow(int v, int u, int mod) {
  if (!u) return 1;
  int res = bPow(v, u / 2, mod);
  res = (res * 1ll * res) % mod;
  if (u & 1) res = (res * 1ll * v) % mod;
  return res;
}
void faster() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  if (0) {
    freopen(
        "a"
        ".in",
        "r", stdin);
    freopen(
        "a"
        ".out",
        "w", stdout);
  }
}
vector<int> prime;
bool notprime[100100];
void resh() {
  int n = 100100 - 10;
  for (int i = 2; i < n; i++)
    if (!notprime[i]) {
      prime.push_back(i);
      for (int j = i; j < n; j += i) notprime[j] = 1;
    }
}
int is_comp(long long p) {
  for (int i = 0; prime[i] * 1ll * prime[i] <= p; i++) {
    if (p % prime[i] == 0) return prime[i];
  }
  return 0;
}
bool is_prime(long long p) {
  for (int i = 0; prime[i] * 1ll * prime[i] <= p; i++) {
    if (p % prime[i] == 0) return 0;
  }
  return 1;
}
long long gcd(long long a, long long b) {
  if (a > b) swap(a, b);
  long long temp;
  while (a) {
    temp = a;
    a = b % a;
    b = temp;
  }
  return b;
}
int n;
void solve() {
  cin >> n;
  cout << n << endl;
  for (int i = 1; i <= n; i++) cout << i << ' ';
}
int main() {
  faster();
  int T = 1;
  cin >> T;
  while (T--) {
    solve();
    cout << endl;
  }
  return 0;
}
