require "prime"

def get_lcm arr
    h = Hash.new(0)
    arr.each{|x| Prime.prime_division(x).each{|p, n| h[p] = n if h[p] < n}}
    lcm = 1
    h.to_a.each{|p, n| lcm *= (p ** n)}
    lcm
end

while true
    n = gets.to_i
    break if n == 0
    arr = []
    n.times{arr << gets.chomp.split.map(&:to_i)}
    arr2 = []
    arr.each{|d, v| arr2 << v}
    lcm = get_lcm(arr2)
    arr2 = []
    arr.each{|d, v| arr2 << lcm * d / v}
    lcm2 = get_lcm(arr2)
    arr.each{|d, v| puts lcm2 * v / d / lcm}
end

