//大整数除法,高精度除以低精度
#include<iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include<vector>
using namespace std;


int divide(string number, int  divided ) {
    int mod = 0;
    for (int i = 0; i < number.size(); i++) {
        int data = mod * 10 + (number[i] - '0');
        mod = data % divided;
    }
    return mod;
}

int main() {
    string number;
    while (cin >> number) {
        if (number == "-1") {
            break;
        }

        vector<int>k_list;
        for (int k = 2; k <= 9; k++) {
            int mod = divide(number, k);
            if (mod == 0) {
                k_list.push_back(k);
            }
        }
        for (int i = 0; i < k_list.size(); i++) {
            printf("%d", k_list[i]);
            printf(i < k_list.size() - 1 ? " " : "\n");
        }
        if (k_list.empty() == true) {
            cout << "none" << endl;
        }
    }


}