#include <bits/stdc++.h>
#pragma optimize("O3")
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int arr[4][10];
int main() {
  long long t;
  cin >> t;
  for (int z = (0); z < (t); z++) {
    long long n;
    set<int> s;
    cin >> n;
    if (n == 1) {
      cout << 2 << "\n";
      cout << 0 << " " << 1 << "\n";
      continue;
    }
    for (int i = 1; (i * i) <= n; i++) {
      s.insert(i);
      s.insert(n / i);
    }
    s.insert(1);
    s.insert(0);
    cout << s.size() << "\n";
    for (auto i : s) {
      cout << i << " ";
    }
    cout << "\n";
  }
}
