#include <bits/stdc++.h>
using namespace std;
struct _ {
  ios_base::Init i;
  _() {
    cin.sync_with_stdio(0);
    cin.tie(0);
    cout << fixed << setprecision(10);
  }
} ___;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cerr << name << " : " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << " : " << arg1 << "  ";
  __f(comma + 1, args...);
}
signed main() {
  long long int __, _ = 0;
  cin >> __;
  for (; _++ < __;) {
    long long int n;
    cin >> n;
    set<long long int> second;
    for (long long int i = 1; i * i <= n; i++) {
      second.insert(i);
      second.insert(n / i);
    }
    cout << second.size() + 1 << '\n';
    cout << 0 << ' ';
    for (auto it : second) cout << it << ' ';
    cout << '\n';
  }
}
