#include <algorithm>
#include <iostream>
using namespace std;
#define LL long long

LL gcd(LL a,LL b){
	if(a<b)swap(a,b);
	while(b!=0){
		LL t=b;
		b=a%b;
		a=t;
	}
	return a;
}


int main(){
	
	int n;
	while(cin>>n,n){
		LL d[10],v[10];
		for(int i=0;i<n;i++){
			cin>>d[i]>>v[i];
			LL t=gcd(d[i],v[i]);
			d[i]/=t;
			v[i]/=t;
		}
		LL dk=d[0],vk=v[0];
		for(int i=1;i<n;i++){
			dk=dk*d[i]/gcd(d[i],dk);
			vk=gcd(vk,v[i]);
		}
		for(int i=0;i<n;i++){
			cout<<(v[i]/vk)*(dk/d[i])<<endl;
		}
	}
	
	return 0;
}
