#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 7;
int n;
vector<int> vt;
int par[N];
int findpar(int u) {
  if (par[u] == u) return u;
  return par[u] = findpar(par[u]);
}
void makeset(int x, int y) { par[findpar(x)] = findpar(y); }
int main() {
  std ::ios ::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int t;
  cin >> t;
  for (; t--;) {
    cin >> n;
    set<int> dp;
    dp.insert(0);
    for (int i = 1; i * i <= n; ++i) {
      dp.insert(i);
      dp.insert(n / i);
    }
    cout << dp.size() << endl;
    for (auto &i : dp) cout << i << ' ';
    cout << endl;
  }
  return 0;
}
