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