#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef unsigned long long ull; #define mm(a,b) memset(a,b,sizeof(a)) #define maxn 100010 #define mod ((int)1e9+7) const ll inf = 0xffffffff; int t, v, sum; int f(int x) { int cnt = 0; while (x) { cnt += x % 10; x /= 10; } return cnt; } bool check(int x) { if (v%x || sum % x) return false; return true; } int main() { int ans; scanf("%d", &t); while (t--) { vectora; scanf("%d", &v); sum = f(v); ans = 0; for (int i = 1; i*i <= v; ++i) { if (check(i)) { ans++; a.push_back(i); } if (v / i != i && check(v / i)) { ans++; a.push_back(v / i); } } cout << ans << endl; sort(a.begin(), a.end()); for (int i = 0; i < a.size(); i++) { if (i) printf(" "); printf("%d", a[i]); } printf("\n"); } }