#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
vector<int> readVec(int n) {
  vector<int> result;
  result.resize(static_cast<std::size_t>(n));
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    result[i] = a;
  }
  return result;
}
void solve() {
  int n;
  cin >> n;
  int b = sqrt(n);
  vector<int> result;
  for (int i = 0; i <= b; i++) {
    result.push_back(i);
  }
  for (int i = b; i > 0; i--) {
    result.push_back(n / i);
  }
  result.erase(unique(result.begin(), result.end()), result.end());
  cout << result.size() << endl;
  for (auto a : result) {
    cout << a << " ";
  }
  cout << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  int t;
  cin >> t;
  for (int i = 0; i < t; i++) {
    solve();
  }
  return 0;
}
