#include "bits/stdc++.h"
#define MAXN 100009
#define INF 1000000007
#define mp(x,y) make_pair(x,y)
#define all(v) v.begin(),v.end()
#define pb(x) push_back(x)
#define wr cout<<"----------------"<<endl;
#define ppb() pop_back()
#define tr(ii,c) for(__typeof((c).begin()) ii=(c).begin();ii!=(c).end();ii++)
#define ff first
#define ss second
#define my_little_dodge 46
#define debug(x) cerr<< #x <<" = "<< x<<endl;
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
ll N;int sz;
vector<pair<ll,int> >v;
bool bad(ll x,ll y){
return (x>N/y);
}
vector<ll>ans;
void rec(int pos,ll mul){
if(pos==sz){
ans.pb(mul+N);
return;
}
ll pw=1;
for(int i=0;i<=v[pos].ss;i++){
if(bad(mul,pw))
return;
rec(pos+1,mul*pw);
pw*=v[pos].ff;
}
}
int main(){
int t;
scanf("%d",&t);
assert(1<=t && t<=10);
while(t--){
ll n;
scanf("%lld",&n);N=n;
int b=sqrt(n);
for(int i=2;i<=b;i++)
if(n%i==0){
int cnt=0;
while(n%i==0)
cnt+=2,n/=i;
v.pb(mp(i,cnt));
}
if(n!=1)
v.pb(mp(n,2));
sz=v.size();rec(0,1);
sort(all(ans));
assert(1<=ans.size() && ans.size()<=int(1e7));
printf("%d\n",ans.size());
tr(it,ans)
printf("%lld\n",*it);
v.clear();ans.clear();
}
return 0;
}
I2luY2x1ZGUgImJpdHMvc3RkYysrLmgiCiNkZWZpbmUgTUFYTiAxMDAwMDkKI2RlZmluZSBJTkYgMTAwMDAwMDAwNwojZGVmaW5lIG1wKHgseSkgbWFrZV9wYWlyKHgseSkKI2RlZmluZSBhbGwodikgdi5iZWdpbigpLHYuZW5kKCkKI2RlZmluZSBwYih4KSBwdXNoX2JhY2soeCkKI2RlZmluZSB3ciBjb3V0PDwiLS0tLS0tLS0tLS0tLS0tLSI8PGVuZGw7CiN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