#include<bits/stdc++.h>
#define rep(i,n)for(ll i=0;i<n;i++)
using namespace std;
typedef long long ll;

ll gcd(ll a, ll b) { if (!b)return a; return gcd(b, a%b); }
ll lcm(ll a, ll b) {
	ll g = gcd(max(a, b), min(a, b));
	return a / g*b / g*g;
}
ll d[20], v[20];
int main() {
	ll n;
	while (scanf("%lld", &n), n) {
		ll ans = 1;
		rep(i, n) {
			scanf("%lld%lld", &d[i], &v[i]);
			ans = lcm(ans, lcm(d[i], v[i]) / v[i]);
		}
		ll g = ans*v[0] / d[0];
		rep(i, n)g = gcd(g, ans*v[i] / d[i]);
		rep(i, n)printf("%lld\n", ans*v[i] / d[i] / g);
	}
}