// Aizu 1154: Monday-Saturday Prime Factors
// 2017.9.13 bal4u@uu

#include <stdio.h>

#define MAX 300000
#define MAX2 35813

char mk[MAX+5];
int tbl[MAX2+5], len;

int main()
{
	int n, i;
	char *p, *q, *pend;
	int *tp;
	
	for (i = 7; i <= MAX; i += 7) mk[i-1] = mk[i+1] = 1;
	for (p = mk, pend = mk + MAX, i = 0; p <= pend; p++, i++) if (*p) {
		for (q = p + i; q <= pend; q += i) *q = 0;
	}
	for (len = 0, i = 1; i <= MAX; i++) if (mk[i]) tbl[len++] = i; tbl[len] = 0x7fffffff;
	while (scanf("%d", &n) && n > 1) {
		printf("%d:", n);
		for (tp = tbl; *tp <= n; tp++) if (n % *tp == 0) printf(" %d", *tp);
		putchar('\n');
	}
	return 0;
}