#include <bits/stdc++.h>
#define NMAX (int)(3*1e6)

using namespace std;

int main(){
	vector<bool> p(NMAX,true);
	vector<int> prime;
	p[0] = false;
	p[1] = false;
	for(int i = 2; i < NMAX; ++i){
		if(!p[i])continue;
		if(i%7 != 1 && i%7 !=6){
			p[i] = false;
			continue;
		}
		prime.push_back(i);
		for(int j = 2; i*j <= NMAX; ++j){
			p[i*j] = false;
		}
	}

	while(true){
		int n; cin >> n;
		if(n == 1)break;
		cout << n << ":";
		for(int i = 0; i < prime.size(); ++i){
			if(n % prime[i] == 0){
				cout << " " << prime[i];
			}
		}
		cout << endl;
	}

	return 0;
}