#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
using namespace std;
template <typename T>
using min_heap = priority_queue<T, vector<T>, greater<T>>;
template <typename T>
using max_heap = priority_queue<T>;
template <typename... T>
void read(T &...args) {
  ((cin >> args), ...);
}
template <typename... T>
void write(T &&...args) {
  ((cout << args), ...);
}
template <typename T>
void readContainer(T &t) {
  for (auto &e : t) read(e);
}
template <typename T>
void writeContainer(T &t) {
  for (const auto &e : t) write(e, " ");
  write("\n");
}
void solve(long long tc) {
  long long N;
  read(N);
  write(N, "\n");
  for (long long i = 1; i <= N; i++) {
    write(i, " ");
  }
  write("\n");
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long tc = 1;
  read(tc);
  for (long long curr = 1; curr <= tc; curr++) solve(curr);
  return 0;
}
