#include <iostream>

typedef unsigned 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];
		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;
		}
		ll s = lcm(d[0], d[1]);
		for (int i = 2; i < n; ++i)s = lcm(s, d[i]);
		for (int i = 0; i < n; ++i)v[i] *= (s / d[i]);
		ll t = gcd(v[0], v[1]);
		for (int i = 2; i < n; ++i)t = gcd(t, v[i]);
		for (int i = 0; i < n; ++i)std::cout << v[i] / t << std::endl;
	}
	return 0;
}