def gcd(m, n)
    if m < n
        gcd(n, m)
    elsif n == 0
        m
    else
        gcd(n, m % n)
    end
end

def lcm(m, n)
    m * n / gcd(m, n)
end

require 'mathn'
loop do
    n = gets.to_i
    break if n == 0
    ds = []
    vs = []
    ts = []
    (1..n).each do
        d, v = gets.split.map(&:to_i)
        ds << d
        vs << v
        ts << d / v
    end
    r = vs.inject(:lcm)
    l = ts.map {|x| x * r}.inject(:lcm)
    puts (0..n-1).map {|i| vs[i] * l / (r * ds[i])}
end
