object Main {
  def from(n: Int): Stream[Int] = Stream.cons(n, from(n + 1))

  def is_msprime(n: Int): Boolean = {
    if(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] = {
    from(6).filter(x => is_msprime(x))
      .takeWhile(_ <= n).filter(x => n % x == 0).toList
  }

  def uniq(l: List[Int]) = {
    l.sorted.foldLeft(Nil: List[Int]){ (acc, next) =>
      if (acc contains next) acc else next :: acc }.reverse
  }

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