#include <bits/stdc++.h>
using namespace std;
bool compar(pair<int, int> a, pair<int, int> b) {
  if (a.first > b.first)
    return true;
  else {
    return false;
  }
}
void solve() {
  int n;
  cin >> n;
  cout << n << "\n";
  for (int i = 0; i < n; i++) {
    cout << i + 1 << " ";
  }
  cout << "\n";
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  srand(chrono::high_resolution_clock::now().time_since_epoch().count());
  long long int t = 1;
  cin >> t;
  while (t--) {
    solve();
  }
}
