#!/usr/bin/ruby -Ku

require 'pp'

def getGCD(a, b)
  return a if b == 0
  return getGCD(b, a%b)
end

loop do
  n = gets.to_i
  break if n == 0
  
  d = Array.new(n)
  v = Array.new(n)
  n.times{ |i|
    data = gets.split(nil).map!{|e| e.to_i}
    d[i], v[i] = data
  }
  
  dpro = d.inject(1){ |p, i| p * i}
  
  p = Array.new(n)
  n.times{|i| p[i] = dpro/d[i]*v[i] }
  
  # p のGCDを求めて割る
  st = Marshal.load(Marshal.dump(p))
  # stの要素数が1になるまでGCD出す
  loop do
    break if st.size == 1
    x = getGCD(st.pop, st.pop)
    st.push x
  end  
  gcd = st.pop
  
  n.times{|i|
    puts p[i]/gcd
  }  
end