#include <iostream>

typedef long long ll;

ll gcd(ll a, ll b){
	if (b == 0)return a;
	else return gcd(b, a % b);
}

ll lcm(ll a, ll b){
	ll c = gcd(a, b);
	return c * (a / c) * (b / c);
}

int main(){
	int n;
	while (std::cin >> n, n){
		ll d[11], v[11], mul = 1;
		for (int i = 0; i < n; ++i){
			std::cin >> d[i] >> v[i];
			ll g = gcd(d[i], v[i]);
			d[i] /= g, v[i] /= g;
			mul = lcm(mul, v[i]);
		}
		for (int i = 0; i < n; ++i)d[i] *= (mul / v[i]);
		ll ans = lcm(d[0], d[1]);
		for (int i = 2; i < n; ++i)ans = lcm(ans, d[i]);
		for (int i = 0; i < n; ++i)std::cout << ans / d[i] << std::endl;
	}
	return 0;
}