#include <bits/stdc++.h>
using ll = long long int;
using namespace std;
void solve() {
  ll n;
  cin >> n;
  cout << n << endl;
  for (ll i = 1; i <= n; i++) cout << i << " ";
  cout << endl;
}
int main() {
  ios ::sync_with_stdio(0);
  cin.tie(NULL);
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
  return 0;
}
