#include <bits/stdc++.h>
using namespace std;
set<int> v;
int n;
int t;
int main() {
  ios::sync_with_stdio(false);
  cin >> t;
  while (t--) {
    v = set<int>();
    v.insert(0);
    cin >> n;
    int len = sqrt(n);
    for (int i = 1; i <= len; ++i) {
      v.insert(i);
      int t = n / i;
      v.insert(t);
    }
    cout << v.size() << endl;
    for (set<int>::iterator i = v.begin(); i != v.end(); ++i) {
      cout << *i << ' ';
    }
    cout << endl;
  }
  return 0;
}
