#include <bits/stdc++.h>
using namespace std;
int main() {
  set<int> a;
  int t, n, sum, i;
  cin >> t;
  for (int term = 0; term < t; term++) {
    cin >> n;
    i = sqrtl(n);
    a.insert(0);
    for (int term1 = 1; term1 <= i; term1++) {
      a.insert(term1);
      a.insert(n / term1);
    }
    cout << a.size() << endl;
    for (set<int>::iterator q = a.begin(); q != a.end(); q++) cout << *q << ' ';
    cout << endl;
    a.clear();
  }
}
