#include <iostream>
#include <vector>
using namespace std;
long long sumaCyfr(long long x) {
long long suma = 0;
while (x > 0) {
suma += x % 10;
x /= 10;
}
return suma;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
if (!(cin >> n)) return 0;
for (int i = 0; i < n; i++) {
long long a;
cin >> a;
vector<long long> wyniki;
long long poczatek = max(1LL, a - 162);
for (long long x = poczatek; x <= a; x++) {
if (x + sumaCyfr(x) == a) {
wyniki.push_back(x);
}
}
cout << wyniki.size() << "\n";
for (size_t j = 0; j < wyniki.size(); j++) {
cout << wyniki[j] << (j + 1 == wyniki.size() ? "" : " ");
}
cout << "\n";
}
return 0;
}