### main

while true
  n = gets.strip.to_i
  break if n == 0

  chlds = []
  n.times.each do
    d, v = gets.strip.split(' ').map{|s| s.to_i}
    chlds << Rational(v, d)
  end

  ngcd = chlds.map{|c| c.numerator}.inject{|ng, cn| ng.gcd(cn)}
  dlcm = chlds.map{|c| c.denominator}.inject{|dl, cd| dl.lcm(cd)}

  chlds.map{|c| (c * dlcm / ngcd).numerator}.each do |cn|
    puts cn
  end
end