#include <bits/stdc++.h>
using namespace std;

typedef struct{
	long long nr,dr;
} Frac;


long long gcd(long long a,long long b){
	if(a % b == 0){
		return b;
	}
	return gcd(b,a%b);
}
long long lcm(long long a,long long b){
	long long g = gcd(a,b);
	return a / g * b;
}

Frac lcm_f(Frac f1,Frac f2){
	long long cdr = lcm(f1.dr,f2.dr);
	long long f1t = cdr / f1.dr;
	long long f2t = cdr / f2.dr;
	long long f1n = f1.nr * f1t;
	long long f2n = f2.nr * f2t;
	long long cnr = lcm(f1n,f2n);
	long long g = gcd(cnr,cdr);
	Frac ret;
	ret.nr = cnr / g;
	ret.dr = cdr / g;
	return ret;
}

long long cal(Frac fr,long long d,long long v){
	return fr.nr * v / fr.dr / d;
}

int main(){
	long long n;
	long long d[11],v[11];
	Frac f[11];
	while(cin >> n,n!=0){
		for(long long i = 0; i < n; i++){
			cin >> d[i] >> v[i];
			f[i].nr = d[i];
			f[i].dr = v[i];
		}
		for(long long i = 1; i < n; i++){
			f[i] = lcm_f(f[i-1],f[i]);
		}
		for(long long i = 0; i < n; i++){
			cout << cal(f[n-1],d[i],v[i]) << endl;
		}
	}
	return 0;
}

