#include <bits/stdc++.h>
using namespace std;
const long long MAX_SIZE = 1000001;
vector<long long> isprime(MAX_SIZE, true);
vector<long long> prime;
vector<long long> SPF(MAX_SIZE);
void manipulated_seive(int N) {
  isprime[0] = isprime[1] = false;
  for (long long int i = 2; i < N; i++) {
    if (isprime[i]) {
      prime.push_back(i);
      SPF[i] = i;
    }
    for (long long int j = 0;
         j < (int)prime.size() && i * prime[j] < N && prime[j] <= SPF[i]; j++) {
      isprime[i * prime[j]] = false;
      SPF[i * prime[j]] = prime[j];
    }
  }
}
set<int> ans;
set<int>::iterator it;
int main() {
  ios::sync_with_stdio(0);
  int t;
  int n;
  cin >> t;
  while (t--) {
    cin >> n;
    ans.clear();
    ans.insert(0);
    for (int i = 1; i * i <= n; i++) {
      ans.insert(n / i);
      ans.insert(n / (n / i));
    }
    ans.insert(n);
    cout << ans.size() << endl;
    for (it = ans.begin(); it != ans.end(); it++) cout << (*it) << " ";
    cout << endl;
  }
  return 0;
}
