#include using namespace std; int T, V, v1, sum, gcd, ans[105], tot; int GCD(int x, int y) { int r = x % y; while (r) x = y, y = r, r = x % y; return y; } int main() { scanf("%d", &T); while (T--) { scanf("%d", &V); v1 = V; sum = 0; while (v1) sum += v1 % 10, v1 /= 10; gcd = GCD(sum, V); tot = 0; for (int i = 1; i <= gcd; i++) if (gcd % i == 0) ans[++tot] = i; printf("%d\n", tot); for (int i = 1; i <= tot; i++) printf("%d%c", ans[i], i == tot? '\n' : ' '); } }