#include using namespace std; int T,v; inline int get(int x) { int ret=0; while (x) { ret+=x%10; x/=10; } return ret; } int main() { scanf("%d",&T); while (T--) { scanf("%d",&v); int num=get(v); vector ans; for (int i=1;i<=num;++i) if (v%i==0&&num%i==0) ans.push_back(i); printf("%d\n",ans.size()); for (int i=0;i<(int)ans.size();++i) printf("%d%c",ans[i],i+1==(int)ans.size()?'\n':' '); } return 0; }