//12252024832524 #include #include #define Min(x,y) (xy?x:y) using namespace std; typedef long long LL; const int MAXN = 100005; int n,n1,tot; int ans[MAXN]; int Read() { int x1 = 0,f1 = 1;char c1 = getchar(); while(c1 > '9' || c1 < '0'){if(c1 == '-')f1 = -1;c1 = getchar();} while(c1 >= '0' && c1 <= '9'){x1 = (x1*10) + (c1^48);c1 = getchar();} return x1 * f1; } int gcd(int x,int y) { if(!y) return x; return gcd(y,x%y); } int main() { // freopen(".in","r",stdin); // freopen(".out","w",stdout); for(int T = Read(); T ;-- T) { n1 = n = Read(); tot = 0; int t = 0; while(n1) { t += n1 % 10; n1 /= 10; } int g = gcd(n,t); for(int i = 1;i*i <= g;++ i) if(g % i == 0) { ans[++tot] = i; ans[++tot] = g / i; } if(ans[tot] * ans[tot] == g) tot--; sort(ans+1,ans+tot+1); printf("%d\n",tot); for(int i = 1;i < tot;++ i) printf("%d ",ans[i]); printf("%d\n",ans[tot]); } return 0; }