#include<stdio.h>
typedef unsigned long long L;
L GCD(L a,L b){return b?GCD(b,a%b):a;}
L LCM(L a,L b){return a/GCD(a,b)*b;}
int main()
{
	int n,i;
	L v[10],d[10],gcd,lcm,t;
	while(scanf("%d",&n),n)
	{
		lcm=1;
		for(i=0;i<n;++i)
		{
			scanf("%lld%lld",d+i,v+i);
			gcd=GCD(v[i],d[i]);
			v[i]/=gcd;
			d[i]/=gcd;
			lcm=LCM(lcm,v[i]);
		}
		t=1;
		for(i=0;i<n;++i)
			t=LCM(t,lcm/v[i]*d[i]);
		for(i=0;i<n;++i)
			printf("%lld\n",t/d[i]*v[i]/lcm);
	}
	return 0;
}