#include<cstdio>
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)

#ifdef __BORLANDC__
	typedef __int64 ll;
#else 
	typedef long long ll;
#endif


typedef pair<ll,ll> pll;

int n;
vector<int> d;
vector<int> s;
bool input(){
	cin>>n;
	if(n==0)return false;
	d=vector<int>(n);
	s=vector<int>(n);
	rep(i,n){
		cin>>d[i]>>s[i];
	}
	return true;
}


ll gcd(ll a, ll b){
	if(a<b)swap(a,b);
	while(1){
		ll c = a%b;
		if(c==0)return b;
		a=b;
		b=c;
	}
}

void tubun(ll* a, ll* b){
	ll c = gcd(*a, *b);
	*a /= c;
	*b /= c;
}

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


pll lcmexp(ll a, ll b, ll c, ll d)
{
	tubun(&a, &b); tubun(&c, &d);
	
	ll bunbo = b*d;
	ll A = a*d;
	ll B = b*c;
	
	//ll gcA = gcd(A, bunbo); A/=gcA; bunbo/=gcA;
	//ll gcB = gcd(B, bunbo); B/=gcB; bunbo/=gcB;
	
	ll C = gcd(A,B);
	ll bunshi = A/C*B/C*C;
	
	//cout<<"bunbo="<<bunbo<<" bunshi="<<bunshi<<"  A="<<A<<"  B="<<B<<endl;
	tubun(&bunbo, &bunshi);
	
	return pll(bunshi, bunbo);
}



vector<int> solve(){
	vector<int> ret;
	
	pll lcme = lcmexp(d[0], s[0], d[1], s[1]);
	reps(i,2,n){
		lcme = lcmexp(lcme.first, lcme.second, d[i], s[i]);
	}
	
	//cout<<"aaa"<<lcme.first<<" "<<lcme.second<<endl;
	
	rep(i,n){
		ret.push_back(lcme.first * s[i] / d[i] / lcme.second);
	}
	
	return ret;
}

void c_solve(){
	vector<int> ans = solve();
	rep(i,ans.size())cout<<ans[i]<<endl;
}

int main(){
	while(input())c_solve();	
}