#include <bits/stdc++.h>
using namespace std;
const int mod = 1e5 + 50;
const int maxn = 1e7 + 50;
const int inf = 0x3f3f3f3f;
unordered_map<int, bool> mp;
vector<int> vec;
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    mp.clear();
    vec.clear();
    int n, t;
    scanf("%d", &n);
    vec.push_back(0);
    for (int i = 1; i * i <= n; i++) {
      t = n / i;
      if (!mp.count(t)) {
        mp[t] = 1;
        vec.push_back(t);
        if (n / t == i) {
          if (!mp.count(i)) {
            mp[i] = 1;
            vec.push_back(i);
          }
        }
      }
    }
    sort(vec.begin(), vec.end());
    printf("%d\n", vec.size());
    for (int i = 0; i < vec.size(); i++) printf("%d ", vec[i]);
    putchar(10);
  }
}
