#include <iostream>
#include <vector>
#include <set>

using namespace std;

vector<int> a;

set<int> f(int n) {
	set<int> ret;
	for (auto i : a) {
		if (i >= n)break;
		if (n % i == 0) {
			int t = n / i;
			if (t % 7 != 1 && t % 7 != 6)continue;
			ret.insert(i);
		}
	}
	ret.insert(n);
	return ret;
}

int main() {
	for (int i = 2; i <= 300000; i++) {
		if (i % 7 == 1 || i % 7 == 6) {
			a.push_back(i);
		}
	}
	int n;
	while (cin >> n && n != 1) {
		int m = a.size();
		set<int> ans = f(n);

		cout << n << ":";
		for (auto i : ans) {
			if (f(i).size() == 1) {
				cout << " " << i;
			}
		}
		cout << endl;
	}
	return 0;
}