#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  set<int> ans;
  ans.insert(0);
  for (int i = 1; i * i <= n; i++) {
    ans.insert(n / i);
    ans.insert(i);
  }
  cout << ans.size() << "\n";
  for (auto x : ans) cout << x << " ";
  cout << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int t = 1;
  cin >> t;
  while (t--) solve();
  return 0;
}
