#include <bits/stdc++.h>
using namespace std;
class comp {
 public:
  bool operator()(int& a, int& b) { return a > b; }
};
bool comp1(pair<int, int> a, pair<int, int> b) { return (a.second < b.second); }
void solve() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> v;
    v.push_back(n);
    for (int i = 2; i <= sqrt(n); i++) {
      if (n / i != v[v.size() - 1]) {
        v.push_back(n / i);
        if (v[v.size() - 1] != i) {
          v.push_back(i);
        }
      }
    }
    if (v[v.size() - 1] != 1) v.push_back(1);
    v.push_back(0);
    sort(v.rbegin(), v.rend());
    cout << v.size() << '\n';
    for (int i = v.size() - 1; i >= 0; i--) {
      cout << v[i] << ' ';
    }
    cout << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
