#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int not_mon_sat_prime[3000001];//initialized to zero

int is_mon_sat(int num)
{
    if(num % 7 == 1 || num % 7 == 6){
        return 1;
    }else{
        return 0;
    }
}


int next_mon_sat(int num)
{
    num++;
    for(; !is_mon_sat(num); num++) ;

    return num;
}

void mon_sat_prime(int num)
{
    int i;
    int limit = sqrt(num);

    not_mon_sat_prime[1] = 1;

    for(i = 2; i <= num; i++){//mon_sat number is 0 others are 1
        if(!is_mon_sat(i)){
            not_mon_sat_prime[i] = 1;
        }
    }

    for(i = 6; i <= limit; i = next_mon_sat(i)){
        int j;
        for(j = 2; j <= num / i; j++){
            not_mon_sat_prime[i * j] = 1;//not a mon_sat_prime number
        }
    }

}

int main(void)
{
    mon_sat_prime(3000000);

    while(1){
        int num;
        int i;

        scanf("%d", &num);

        printf("%d: ", num);

        for(i = 1; i <= num; i++){
            if(!not_mon_sat_prime[i] && num % i == 0){
                printf("%d ", i);
            }
        }

        printf("\n");


        if(num == 1)
            break;
    }

    return 0;
}