#include #include using namespace std; int T, V, tmp, sum, ans1[10010], ans2[10010]; int main() { scanf("%d", &T); while (T--) { scanf("%d", &V); tmp = V; sum = 0; while (tmp) { sum += tmp % 10; tmp /= 10; } ans1[0] = ans2[0] = 0; for (int i = 1; i * i <= V; ++i) if (V % i == 0) { if (sum % i == 0) ans1[++ans1[0]] = i; if (V / i != i && sum % (V / i) == 0) ans2[++ans2[0]] = V / i; } printf("%d\n%d", ans1[0] + ans2[0], ans1[1]); for (int i = 2; i <= ans1[0]; ++i) printf(" %d", ans1[i]); for (int i = ans2[0]; i > 0; --i) printf(" %d", ans2[i]); printf("\n"); } return 0; }