#!/usr/bin/ruby

def isprime(n)
  i = 8
  while i <= Math.sqrt(n)
    return false if n % i == 0
    i += 5
    return false if n % i == 0
    i += 2
  end
  return true
end

def compute(target)
  ans = {}
  i   = 6
  while i <= target
    if target % i == 0 and isprime(i)
      ans[i] = 1
    end
    i += 2
    if target % i == 0 and isprime(i)
      ans[i] = 1
    end
    i += 5
    #puts i
  end

  puts "#{target}: #{ans.keys.sort.join(" ")}"
end

while n = gets
  n = n.to_i
  break if n == 1
  compute(n)
end