#include <bits/stdc++.h>
using namespace std;
const int N = 2e6 + 5;
int T, _w, n, res, dat[N];
int main(void) {
  cin >> T;
  while (T--) {
    cin >> n;
    dat[res = 1] = 0;
    for (int i = 1, r; i <= n; i = r + 1) {
      r = (n / (n / i));
      dat[++res] = n / i;
    }
    printf("%d\n", res);
    sort(dat + 1, dat + 1 + res);
    for (int i = 1; i <= res; ++i) printf("%d%c", dat[i], " \n"[i == res]);
  }
  return 0;
}
