#include <iostream>
#include <vector>
using namespace std;

int main() {
  vector <int> so;
  bool s[310000] = {0};

  bool flg;
  for(int i=2;i<300000;i++) {
    if((i % 7 == 1 || i % 7 == 6) && s[i] == 0) {
      so.push_back(i);
      for(int j=2;j*i<=300000;j++) s[i*j] = 1;
    }else s[i] = 1;
  } 
  
  //cout << "ok" << endl;
  
  //  for(int i=2;i<=300000;i++) if(s[i] == 0) cout << i << endl;

  int n;
  while(1) {

    cin >> n;
    if(n == 1) break;

    cout << n << ":";
    for(int i=0;i<so.size();i++) {
      if(n % so[i] == 0) cout <<" "<< so[i];
    }
    cout << endl;

  }
  
  return 0;
  
}