#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t{}, T{};
  cin >> t;
  T = t;
  while (t--) {
    long long n{}, m{}, ans{}, k{}, a{}, b{}, c{}, f{1};
    cin >> n;
    set<long long> s;
    s.insert(n);
    s.insert(0);
    for (long long i = 1; i * i <= n; ++i) {
      s.insert(i);
      s.insert(n / i);
    }
    cout << s.size() << "\n";
    for (auto x : s) {
      cout << x << " ";
    }
    cout << "\n";
  }
  return 0;
}
