#include <iostream>

#define rep(i,n) for(int i=0; i<(n); i++)

using namespace std;

bool check[300001];

int main() {
	rep(i, 300001) {
		if((i%7==1) || (i%7==6)) check[i] = true;
	}
	check[1] = false;
	rep(i, 300001) {
		if(check[i]) {
			for(int j = i * 2; j < 300001; j+=i) {
				check[j] = false;
			}
		}
	}
	int n;
	while(cin >> n) {
		if(n == 1) break;
		cout << n << ":";
		rep(i, n+1) {
			if(check[i] && n % i == 0) {
				cout << " " << i;
			}
		}
		cout << endl;
	}
	return 0;
}