until (n = gets.to_i).zero?
  student = n.times.map{gets.split.map(&:to_i)}
  student.map! do |d, v| [d / d.gcd(v), v / d.gcd(v)] end
  lcm = 1
  gcd = student[0][1]
  student.each do |d, v|
    lcm = lcm.lcm(d)
    gcd = gcd.gcd(v)
  end
  puts student.map{|d, v| lcm * v / d / gcd}
end