#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 5, INF = 0x3f3f3f3f;
inline int read() {
  int x = 0, f = 0;
  char ch = 0;
  while (!isdigit(ch)) f |= ch == '-', ch = getchar();
  while (isdigit(ch)) x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
  return f ? -x : x;
}
int a[N], b[N];
int main() {
  int Q = read();
  while (Q--) {
    int n = read();
    printf("%d\n", n);
    for (int i = 1; i <= n; i++) printf("%d ", i);
  }
  return 0;
}
