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

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

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

ll d[10], v[10];

int main()
{
	int n;
	
	while (scanf("%d", &n), n){
		ll m = 1ll;
		rep(i, n){
			scanf("%lld %lld", &d[i], &v[i]);
			ll t = gcd(d[i], v[i]);
			d[i] /= t;
			v[i] /= t;
		}
		ll l = 1;
		rep(i, n){
			l = lcm(l, d[i]);
		}
		rep(i, n){
			v[i] *= (l / d[i]);
		}
		ll g = v[0];
		rep(i, n){
			g = gcd(g, v[i]);
		}
		rep(i, n){
			printf("%lld\n", v[i] / g);
		}
	}
}