#include <bits/stdc++.h>
using namespace std;
const int MAXN = 10005;
const int MAXM = 500005;
const int INF = 0x3f3f3f3f;
inline int read() {
  int x = 0, k = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') k = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9')
    x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
  return x * k;
}
int main() {
  ios::sync_with_stdio(false);
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    int cnt = n;
    int ans = 1;
    vector<int> v;
    v.push_back(0);
    while (cnt > 0) {
      ans++;
      v.push_back(n / cnt);
      cnt = n / (n / cnt + 1);
    }
    sort((v).begin(), (v).end());
    cout << ans << "\n";
    for (int i : v) cout << i << " ";
    cout << "\n";
  }
  return 0;
}
