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