#include <iostream>
#define rep2(x,from,to) for(int x=(from);(x)<(to);(x)++)
#define rep(x,to) rep2(x,0,to)
using namespace std;
#define ll long long
ll gcd(ll a, ll b) {
	if(b==0) return -1;
	if(a<b) swap(a,b);
	while(b) {
		ll t = a / b;
		swap(a-=t*b,b);
	}
	return a;
}
ll lcm(ll a, ll b) {
	ll c = gcd(a,b);
	return a * b / c;
}
int main(){
	int n;
	while(cin >> n, n) {
		ll d[10], v[10];
		rep(i,n) {
			cin >> d[i] >> v[i];
		}
		ll tr = d[0], td = v[0];
		rep2(i,1,n) {
			tr = lcm(tr * v[i], td * d[i]);
			td *= v[i];
			ll div = gcd(tr,td);
			tr /= div, td /= div;
		}
		rep(i,n) {
			cout << (tr*v[i]) /(d[i]*td) << endl;
		}
	}
}