#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    set<int> s;
    for (int i = 0; i * i <= n; i++) {
      s.insert(i);
      if (i != 0) s.insert(n / i);
    }
    cout << s.size() << endl;
    for (auto it = s.begin(); it != s.end(); it++) cout << *it << " ";
    cout << endl;
  }
  return 0;
}
