#include <bits/stdc++.h>
using namespace std;
int kase, n;
vector<int> vc;
int main() {
  scanf("%d", &kase);
  while (kase--) {
    scanf("%d", &n);
    vc.clear();
    vc.push_back(0);
    for (int i = 1; i * i <= n; i++) {
      vc.push_back(i);
      vc.push_back(n / i);
      if (i == n / i) vc.pop_back();
    }
    sort(vc.begin(), vc.end());
    vc.erase(unique(vc.begin(), vc.end()), vc.end());
    printf("%d\n", vc.size());
    for (auto it : vc) printf("%d ", it);
    puts("");
  }
  return 0;
}
