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

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

#define MAX 300000
#define SQ  547				// 547 = sqrt(300000)

char mk[MAX+2];
int spool[550];

int main()
{
	int n, i, j, k;
	
	for (i = 7; i <= MAX; i += 7) mk[i-1] = mk[i+1] = 1;
	for (i = 0; i <= SQ; i++) if (mk[i]) {
		for (j = i*i; j <= MAX; j+=i) mk[j] = 0;
	}

	while (scanf("%d", &n) && n > 1) {
		printf("%d:", n);
		k = (int)sqrt(n);
		j = 0; if (mk[n]) spool[j++] = n;
		for (i = 2; i <= k; i++) {
			if (n % i == 0) {
				if (mk[i]) printf(" %d", i);
				if (mk[n / i]) spool[j++] = n / i; 
			}
		}
		if (j > 0 && spool[j-1] == k) j--;
		if (j > 0) while (j--) printf(" %d", spool[j]);

		putchar('\n');
	}
	return 0;
}