#include<iostream> #include<cstdio> #include<string> using namespace std; bool Function(string num,int k){ int total=0; for(int i=0;i<num.size();i++){ int digit =num[i]-'0'; total *=10; total +=digit; total %=k; } return total ==0; } int main(){ string num; int pos=0; while(getline(cin,num)){ if(num[0] =='-'){ cout<<"none"<<endl; }else{ for(int k=2;k<=9;k++){ if(Function(num,k)){ cout<<k<<" "; pos++; } } if(pos==0){ cout<<"none"<<endl; return 0; } getchar(); cout<<endl; } } return 0; }