#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
const int maxn = 2e5 + 100;
const int mod = 1e9 + 7;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int first = 1;
    set<int> se;
    while (first * first <= n) {
      se.insert(n / first);
      first++;
    }
    int a = *se.begin();
    while (a > 0) {
      int b = n / a;
      if (n / b == a) se.insert(a);
      a--;
    }
    se.insert(0);
    cout << (int)se.size() << "\n";
    for (int val : se) cout << val << " ";
    cout << "\n";
  }
  return 0;
}
