//土尔逊Torson 编写于2023/05/31
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<string>
#include<stdlib.h>
using namespace std;
bool isDividable(string num, int divider) {
int total = 0;
for (int i = 0; i<num.size(); i++) {
int digit = num[i] - '0';
total *= 10;
total += digit;
total %= divider;
}
return total == 0;
}
int main() {
string c;
while (cin >> c) {
if (c == "-1") break;
bool first = true;
for (int i = 2; i < 10; i++) {
if (isDividable(c, i)) {
if (first) {
first = false;
}
else {
cout << " ";
}
cout << i;
}
}
if (first) cout << "none";
cout << endl;
}
system("pause");
return EXIT_SUCCESS;
}
// 64 位输出请用 printf("%lld")