object Main {
  def is_msprime(n: Int): Boolean = {
    if (n == 1 || (n % 7 != 1 && n % 7 != 6)) return false
    var x = 6
    var c = 0
    val y = List(2, 5)
    while(n >= x * x) {
      if (n % x == 0) return false
      x += y(c % 2)
      c += 1
    }
    true
  }

  def msprime_factorize(n: Int): List[Int] = {
    List(for (i <- 1 to math.sqrt(n).toInt if n % i == 0 && is_msprime(i)) yield i,
         for (i <- 1 to math.sqrt(n).toInt if n % i == 0 && i != n / i && is_msprime(n / i)) yield n / i).flatten
  }

  def main(args:Array[String]) = {
    val sc = new java.util.Scanner(System.in)
    var n = sc.nextInt
    while(n != 1) {
      println(n + ": " + msprime_factorize(n).sorted.mkString(" "))
      n = sc.nextInt
    }
  }
}