fun main(args:Array<String>?): Unit {
    while(true){
        val n = readLine()!!.trim().toInt()
        if (n == 0) return
        val runner = Array(n){
            val (d, v) = readLine()!!.trim().split(' ').map(String::toLong)
            Pair(d, v)
        }
        val time = runner.fold(1L){time, (d, v) ->
            val a = d / gcd(d, v)
            time * a / gcd(time, a)
        }
        val g = runner.map{(d, v) -> time * v / d}.reduce(::gcd)
        for ((d, v) in runner){
            println(time * v / d / g)
        }
    }
}
tailrec fun gcd(a: Long, b: Long): Long {
    return if (b == 0L) a else gcd(b, a % b)
}
