#include <iostream> using namespace std; string s; int div(string c, int x) { int remain = 0; for(int i = 0; i < c.size(); i++) { int k = remain * 10 + c[i] - '0'; c[i] = k / x + '0'; remain = k % x; } if(remain) return remain; return 0; } int main() { while(cin >> s) { if(s == "-1") break; int sum = 0; for(int i = 2; i < 10; i++) { if(div(s, i) == 0) { printf("%d ", i); sum++; } } if(!sum) printf("none\n"); else printf("\n"); } }