#include <bits/stdc++.h>
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx,avx2,fma")
using namespace std;
const long long mod1 = 998244353;
const long long mod = 1e9 + 7;
long long mod_mul(long long a, long long b) {
  a = a % mod;
  b = b % mod;
  return (((a * b) % mod) + mod) % mod;
}
long long inv(long long i) {
  if (i == 1) return 1;
  return (mod - ((mod / i) * inv(mod % i)) % mod) % mod;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
long long pwr(long long a, long long b) {
  a %= mod;
  long long res = 1;
  while (b > 0) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
    b >>= 1;
  }
  return res;
}
class Graph {
  long long V;
  list<long long> *adj;

 public:
  Graph(long long V);
  void addEdge(long long v, long long w);
  void BFS(long long s);
  void DFS(int v);
};
Graph::Graph(long long V) {
  this->V = V;
  adj = new list<long long>[V];
}
void Graph::addEdge(long long v, long long w) { adj[v].push_back(w); }
void Graph::BFS(long long s) {
  bool *visited = new bool[V];
  for (long long i = 0; i < V; i++) visited[i] = false;
  list<long long> queue;
  visited[s] = true;
  queue.push_back(s);
  list<long long>::iterator i;
  while (!queue.empty()) {
    s = queue.front();
    cout << s << " ";
    queue.pop_front();
    for (i = adj[s].begin(); i != adj[s].end(); ++i) {
      if (!visited[*i]) {
        visited[*i] = true;
        queue.push_back(*i);
      }
    }
  }
}
long long findMinNumber(long long n) {
  long long count = 0, ans = 1;
  while (n % 2 == 0) {
    count++;
    n /= 2;
  }
  if (count % 2) ans *= 2;
  for (int i = 3; i <= sqrt(n); i += 2) {
    count = 0;
    while (n % i == 0) {
      count++;
      n /= i;
    }
    if (count % 2) ans *= i;
  }
  if (n > 2) ans *= n;
  return ans;
}
long long binarySearch(long long arr[], long long l, long long r, long long x) {
  if (r >= l) {
    long long mid = l + (r - l) / 2;
    if (arr[mid] == x) return mid;
    if (arr[mid] > x) return binarySearch(arr, l, mid - 1, x);
    return binarySearch(arr, mid + 1, r, x);
  }
  return -1;
}
long long nCrModp(long long n, long long r, long long p) {
  if (r > n - r) r = n - r;
  long long C[r + 1];
  memset(C, 0, sizeof(C));
  C[0] = 1;
  for (long long i = 1; i <= n; i++) {
    for (long long j = min(i, r); j > 0; j--) C[j] = (C[j] + C[j - 1]) % p;
  }
  return C[r];
}
long long count_set_bit(long long n) {
  long long count = 0;
  while (n) {
    count += n & 1;
    n >>= 1;
  }
  return count;
}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t;
  cin >> t;
  while (t--) {
    long long n;
    cin >> n;
    set<long long> ans;
    long long k = 1;
    while ((n / k) > 1) {
      long long c = n / k;
      long long v = n / (c - 1);
      if (v == k) {
        v++;
      }
      k = v;
      ans.insert(c);
    }
    ans.insert(0);
    ans.insert(1);
    cout << ans.size() << '\n';
    for (auto i : ans) {
      cout << i << " ";
    }
    cout << '\n';
  }
  return 0;
}
