#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vc = vector<char>;
using pii = pair<int, int>;
using vpii = vector<pii>;
int t;
int main() {
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    cout << n << '\n' << 1;
    for (int i = 1; i < n; i += 1) {
      cout << ' ' << i + 1;
    }
    cout << '\n';
  }
}
