#include <bits/stdc++.h>
using namespace std;
bool zc(string c, int k)
{
int ys = 0;
for (int i = 0; i < c.size(); i++)
{
ys = ys * 10 + c[i] - 48;
ys %= k;
}
return ys;
}
int main()
{
string c;
cin >> c;
bool f = true;
for (int i = 2; i < 10; i++)
{
if (!zc(c, i))
{
cout << i << " ";
if (f == true)
f = false;
}
}
if (f)
cout << "none";
return 0;
}