#include <bits/stdc++.h>
using namespace std;
int l;
int P(string s, int k) {
int y = 0;
for (int i = 0; i < s.size(); i++) {
y = (y * 10 + s[i] - '0') % k;
}
if (y == 0) {
return 1;
} else {
return 0;
}
}
int main() {
string a;
while (cin >> a) {
vector<int> ans;
l = 0;
if (a[0] == '-') {
continue;
}
for (int i = 2; i < 10; i++) {
if (P(a, i) == 1) {
ans.push_back(i);
l++;
}
}
if (l == 0) {
cout << "none";
} else {
for (int i = 0; i < l; i++) {
cout << ans[i] << " ";
}
}
cout << endl;
}
return 0;
}
// 64 位输出请用 printf("%lld")