#include <bits/stdc++.h>
using namespace std;
bool solve() {
  int n;
  cin >> n;
  set<int> s;
  s.insert(0);
  for (int i = n; i > 0;) {
    s.insert(n / i);
    i = n / ((n / i) + 1);
  }
  cout << s.size() << endl;
  for (auto& x : s) cout << x << " ";
  cout << endl;
  return true;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int q;
  cin >> q;
  while (q--) {
    if (solve()) {
    } else {
    }
  }
  return 0;
}
