#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 5;
void solve() {
  int n;
  cin >> n;
  int last = -1;
  vector<int> a;
  for (int i = n + 1; n / i < n; i--) {
    if (n / i != last)
      a.push_back(n / i), last = n / i;
    else {
      int l = 1, r = i, idx = 0;
      while (l <= r) {
        int mid = (l + r) / 2;
        if (n / mid <= last)
          r = mid - 1, idx = mid;
        else if (n / mid > last)
          l = mid + 1;
      }
      i = idx;
    }
  }
  a.push_back(n);
  cout << a.size() << '\n';
  for (auto a : a) cout << a << ' ';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int t = 1;
  cin >> t;
  while (t--) {
    solve();
    cout << '\n';
  }
  return 0;
}
