#include<iostream>
using namespace std;
long long n,a[100],b[100],c[100];
long long gcd1;
long long gcd(long long a,long long b){
	if(b==0){return a;}
	return gcd(b,a%b);
}
int main(){
	while(true){
		cin>>n;
		if(n==0){break;}
		gcd1=1;
		for(int i=0;i<n;i++){
			cin>>a[i]>>b[i];
			int GCD2=gcd(a[i],b[i]);
			a[i]/=GCD2;b[i]/=GCD2;
			int GCD=gcd(gcd1,a[i]);
			gcd1=gcd1*a[i]/GCD;
		}
		for(int i=0;i<n;i++){
			c[i]=gcd1*b[i]/a[i];
		}
		int gcd2=c[0];
		for(int i=1;i<n;i++){
			gcd2=gcd(gcd2,c[i]);
		}
		for(int i=0;i<n;i++){
			cout<<c[i]/gcd2<<endl;
		}
	}
	return 0;
}