### main

loop do
  n = gets.to_i
  break if n == 0

  bevs = []
  bods = []
  for b in gets.split.map(&:to_i)
    if (b & 1) == 0
      bevs << b
    else
      bods << b
    end
  end
  bevs.sort!
  bods.sort!
  #p bevs
  #p bods

  fact2 = 1
  b1 = bevs[0]
  while (b1 & 1) == 0
    b1 >>= 1
    fact2 <<= 1
  end
  #p fact2

  bev0 = bevs[0] / fact2
  bev1 = bevs[1] / fact2
  bod0 = bods[0]
  #p [bev0, bev1, bod0]

  b0 =  Math.sqrt(bev0 * bev1 / bod0 + 0.5).to_i * fact2

  puts b0
  puts bevs.map{|bev| bev / b0}.join(' ')
end