MAX = 300000

number = Array.new(MAX + 10, false)
i = 1
j = 6
while i <= MAX do
  number[i] = number[j] = true
  i += 7
  j += 7
end

isPrime = Array.new(MAX + 10, true)
isPrime[0] = isPrime[1] = false
for i in 2..MAX do
  next if !number[i]
  (i+i).step(MAX, i) do |j|
    isPrime[j] = false
  end
end

while (n = gets.to_i) != 1 do
  printf "%d:", n
  for i in 6..n do
    next if !number[i]
    next if !isPrime[i]
    next if n % i != 0
    printf " %d", i
  end
  puts
end