#include<iostream>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
ll lcm(ll a,ll b){return a/__gcd(a,b)*b;}
int main(){
	int n,d[10],v[10],t;
	while(cin>>n,n){
		rep(i,n)cin>>d[i]>>v[i],t=__gcd(d[i],v[i]),d[i]/=t,v[i]/=t;
		ll a=d[0],b=v[0];
		rep(i,n)a=lcm(a,d[i]),b=__gcd(b,(ll)v[i]);
		rep(i,n)cout<<a/b*v[i]/d[i]<<endl;
	}
	return 0;
}