#include long long read() { char last = '+', ch = getchar(); while (ch < '0' || ch > '9') last = ch, ch = getchar(); long long tmp = 0; while (ch >= '0' && ch <= '9') tmp = tmp * 10 + ch - 48, ch = getchar(); if (last == '-') tmp = -tmp; return tmp; } int T; int ansn; int ans[1000000]; int main() { scanf("%d", &T); while (T--) { int x = read(); int tmp = x; int s = 0; while (tmp) { s += tmp % 10; tmp /= 10; } ansn = 0; for (int i = 1; i <= s; i++) { if (s % i == 0 && x % i == 0) { ansn++; ans[ansn] = i; } } printf("%d\n", ansn); for (int i = 1; i <= ansn; i++) { if (i != 1) { printf(" "); } printf("%d", ans[i]); } puts(""); } return 0; }