#include <bits/stdc++.h>
using namespace std;
int m, n, t;
int main() {
  scanf("%d", &t);
  while (t--) {
    scanf("%d", &n);
    int l = 0, r = n;
    vector<int> v;
    for (int i = 1; i < (int)sqrt(n); i++) v.push_back(n / i);
    if ((int)sqrt(n) == n / ((int)sqrt(n)))
      v.push_back((int)sqrt(n));
    else
      v.push_back(n / (int)sqrt(n)), v.push_back((int)sqrt(n));
    for (int i = (int)sqrt(n) - 1; i >= 1; i--) v.push_back(i);
    printf("%d\n0 ", v.size() + 1);
    for (int i = v.size() - 1; i >= 0; i--) printf("%d ", v[i]);
    puts("");
  }
  return 0;
}
