#include <bits/stdc++.h>
using namespace std;
long long int insig;
void Out(vector<long long int> x) {
  for (long long int i = 0; i < x.size(); i++) {
    cout << x[i] << " ";
  }
  cout << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long int T;
  cin >> T;
  for (long long int t = 0; t < T; t++) {
    long long int n;
    cin >> n;
    vector<long long int> ans;
    ans.push_back(0);
    for (long long int i = 1; i < sqrt(n) + 2; i++) {
      ans.push_back(n / i);
    }
    for (long long int i = 1; i < sqrt(n) + 2; i++) {
      if ((i + 1) * (n % i) < n) {
        ans.push_back(i);
      }
    }
    sort(ans.begin(), ans.end());
    long long int s = 1;
    for (long long int i = 1; i < ans.size(); i++) {
      if (ans[i] != ans[i - 1]) {
        s++;
      }
    }
    cout << s << endl;
    cout << ans[0] << " ";
    for (long long int i = 1; i < ans.size(); i++) {
      if (ans[i] != ans[i - 1]) {
        cout << ans[i] << " ";
      }
    }
    cout << endl;
  }
  return 0;
}
