#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
template <typename T>
using lim = numeric_limits<T>;
template <typename T>
istream& operator>>(istream& is, vector<T>& a) {
  for (T& x : a) {
    is >> x;
  }
  return is;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    if (n == 1) {
      cout << 2 << endl;
      cout << "0 1" << endl;
    } else {
      int sqrtn = int(sqrt(n) + 0.5);
      set<int> ans = {0};
      for (int i = 1; i <= sqrtn + 1; i++) {
        ans.insert(n / (n / i));
        ans.insert(n / ((n + i - 1) / i));
      }
      for (int i = 1; i <= sqrtn + 1; i++) {
        ans.insert(n / i);
      }
      cout << ans.size() << endl;
      for (int x : ans) {
        cout << x << " ";
      }
      cout << endl;
    }
  }
  return 0;
}
