#include <stdio.h>

int counter = 0;
int currTable[10000];
int currTableSize = 0;

int getFactors(int num)
{
	counter++;
	int flag = 1;
	int flag2 = 1;
	int t = 0;
	if ((num - 1) % 7 == 0)
		t = (num - 1) / 7;
	if ((num + 1) % 7 == 0)
	{
		t = (num + 1) / 7;
		flag2 = 0;
	}

	for (int m = 1; m < t; m++)
	{
		for (int n = m; n < t; n++)
		{
			if (flag2)
			{
				if (t == (7 * m * n + m + n))
				{
					getFactors(7 * m + 1);
					getFactors(7 * n + 1);
					flag = 0;
				}
				else if (t == (7 * m * n - m - n))
				{
					getFactors(7 * m - 1);
					getFactors(7 * n - 1);
					flag = 0;
				}
			}
			else
			{
				if (t == (7 * m * n - m + n))
				{
					getFactors(7 * m + 1);
					getFactors(7 * n - 1);
					flag = 0;
				}
				else if (t == (7 * m * n + m - n))
				{
					getFactors(7 * m - 1);
					getFactors(7 * n + 1);
					flag = 0;
				}
			}
		}
		if (m * m * 7 > t)
			break;
	}

	if (flag)
	{
		int i = 0;
		for (i = 0; currTable[i] != 0; i++)
		{
			if (num == currTable[i])
				return 0;
		}
		currTable[i] = num;
		currTableSize = i;
	}
}

int main()
{
	for (int num; (scanf("%d", &num)) && num != 1; printf("\n"))
	{
		printf("%d:", num);
		getFactors(num);
		int flag = 1;
		while (flag)
		{
			flag = 0;
			for (int i = 0; i < currTableSize; i++)
			{
				if (currTable[i] > currTable[i + 1])
				{
					int temp = currTable[i + 1];
					currTable[i + 1] = currTable[i];
					currTable[i] = temp;
					flag = 1;
				}
			}
		}
		for (int i = 0; i <= currTableSize; i++)
		{
			printf(" %d", currTable[i]);
			currTable[i] = 0;
		}
		currTableSize = 0;
	}
	return 0;
}

