#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]);
			m = lcm(m, v[i]);
		}
		rep(i, n){
			d[i] *= (m / v[i]);
		}
		m = d[0];
		rep(i, n){
			m = lcm(m, d[i]);
		}
		rep(i, n){
			printf("%lld\n", m / d[i]);
		}
	}
}