#include <iostream>

using namespace std;

const int MAX_N = 300000;
bool msp[MAX_N + 10];

void init()
{
    for (int i = 0; i <= MAX_N; i++) {
        if (i % 7 == 1 || i % 7 == 6)
            msp[i] = true;
        else
            msp[i] = false;
    }

    msp[0] = msp[1] = false;
    for (int i = 6; i * i <= MAX_N; i++) {
        if (msp[i])
            for (int j = 2 * i; j <= MAX_N; j += i)
                msp[j] = false;
    }
}

int main()
{
    int num;

    init();

    while (cin >> num, num != 1) {
        cout << num << ":";
        for (int i = 0; i <= num; i++)
            if (msp[i] && num % i == 0)
                cout << " " << i;
        cout << endl;
    }

    return 0;
}