#include<stdio.h>
#include<string.h>
int n;
int array[300000];
int main(void){
    int p[300000]={0};
    int size=0;
    array[0]=6;
    for(int i=1;;i++){
        array[i*2-1]=7*i+1;
        array[i*2]=7*i+6;
        size=2*i;
        if(array[i*2]>300000) break;
    }
    for(int i=0;i<=size;i++){
        if(p[array[i]]==1) continue;
        for(int j=2*array[i];j<300000;j+=array[i]){
            p[j]=1;
        }
    }
    while(1){
        int i;
        scanf("%d",&n);
        if(n==1) break;
        int judge[300000]={0};
        for(i=0;array[i]<=n;i++){
            if(!p[array[i]]&&n%array[i]==0){
                judge[i]=1;
            }
        }
        printf("%d:",n);
        for(int j=0;j<=i;j++)
            if(judge[j]==1)
                printf(" %d",array[j]);
        puts("");
    }
}

