#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> ans;
    ans.push_back(0);
    for (int i = 1; i <= n;) {
      ans.push_back(n / i);
      i = (n / (n / i)) + 1;
    }
    sort(ans.begin(), ans.end());
    cout << (int)ans.size() << "\n";
    for (int i : ans) cout << i << " ";
    cout << "\n";
  }
  return 0;
}
