#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
int m, n, t, ta, tb, a[maxn];
set<int> S;
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> t;
  while (t--) {
    cin >> n;
    S.clear();
    S.insert(0);
    int tmp = sqrt(n);
    for (int i = 1; i <= tmp; i++) {
      S.insert(i);
      S.insert(n / i);
    }
    cout << S.size() << endl;
    bool f = true;
    for (auto i : S) {
      if (f)
        f = false;
      else
        cout << ' ';
      cout << i;
    }
    cout << endl;
  }
  return 0;
}
