#include<cstdio>
#include<cstring>
using namespace std;

typedef long long ll;
int n;
ll d[10001],v[10001],k[10001],res[10001];

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

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

int main(void){
	while(1){
		scanf("%d",&n);
		if(n==0)break;
		for(int i=0;i<n;i++){
			scanf("%lld%lld",&d[i],&v[i]);
			ll G=gcd(d[i],v[i]);
			d[i]/=G;
			v[i]/=G;
		}
		ll dist=lcm(d[0],d[1]);
		for(int i=2;i<n;i++)dist=lcm(dist,d[i]);
		for(int i=0;i<n;i++)k[i]=dist/d[i]*v[i];
		ll t=gcd(k[0],k[1]);
		for(int i=2;i<n;i++)t=gcd(t,k[i]);
		for(int i=0;i<n;i++)res[i]=k[i]/t;
		for(int i=0;i<n;i++)printf("%lld\n",res[i]);
	}
	return 0;
}