//
//  main.c
//  Monday-Saturday Prime Factors
//
//  Created by x15071xx on 2016/06/19.
//  Copyright ?? 2016??´ AIT. All rights reserved.
//

#include <stdio.h>
#include <math.h>
int monsat (int a);
int monsatprime (int a);

int main(int argc, const char * argv[]) {
    
    
    while (1) {
        
        int b,i;
        
        scanf("%d",&b);
        
        if (b==1) {
            break;
        }
        
        printf("%d:",b);
        
        for (i=2; i<=b; i++) {
            if (monsat(i)) {
                if (b%i == 0) {
                    if (monsatprime(i)) {
                        printf(" %d",i);
                    }
                }
                
            }
            
        }
        
        printf("\n");
        
    }
    
    
    return 0;
}


int monsat (int a) {
    
    int x = a % 7;
    
    if (x == 1 || x == 6) {
        x = 1;
        return x;
    }
    
    x = 0;
    
    return 0;
}


int monsatprime (int a) {
    
    int i, x=1;
    
    for (i=2; i<a; i++) {
        if (monsat(i)) {
            if (a%i == 0) {
                x = 0;
                return x;
            }
        }
    }
    
    return x;
}