def gcd(x, y)
	if y == 0 then
		return x
	end
	return gcd(y, x % y);
end
while true do
	n = gets.to_i
	if n == 0 then
		break
	end
	a = Array.new(n);
	b = Array.new(n);
	for i in 0 .. n-1 do
		a[i], b[i] = gets.split.map(&:to_i)
		r = gcd(a[i], b[i]); a[i] /= r; b[i] /= r;
	end
	s = 1;
	for i in 0 .. n-1 do
		s = s / gcd(s, b[i]) * b[i]
	end
	for i in 0 .. n-1 do
		a[i] *= s / b[i];
	end
	s = 1
	for i in 0 .. n-1 do
		s = s / gcd(s, a[i]) * a[i]
	end
	for i in 0 .. n-1 do
		p s / a[i]
	end
end