#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template <class T>
using pii = pair<T, T>;
template <class T>
using vi = vector<T>;
const int MOD = 1000000007;
const int N = 1001;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cin.exceptions(cin.failbit);
  int T;
  cin >> T;
  while (T--) {
    int n;
    cin >> n;
    cout << n << "\n";
    for (int i = 1; i <= n; i++) {
      cout << i << " ";
    }
    cout << "\n";
  }
  return 0;
}
