#include<iostream>
using namespace std;

long long gcd(long long a, long long b){
	if(b == 0)
		return a;
	return gcd(b, a%b); 
}

long long lcm(long long a, long long b){
	return a * b / gcd(a, b);
}

int n;
long long *d;
long long *v;
long long tg,tl;
long long ans;

int main(){
	while(true){
		cin >> n;
		if(!n)
			return 0;
		d = new long long[n];
		v = new long long[n];
		tl = 1;
		for(int i=0; i<n; i++){
			cin >> d[i] >> v[i];
			long long tmp = gcd(d[i], v[i]);
			d[i] /= tmp;
			v[i] /= tmp;
			tl = lcm(tl, d[i]);
			if(!i)
				tg = v[i];
			else
				tg = gcd(tg, v[i]);
		}
		for(int i=0; i<n; i++)
			cout << tl * v[i] / d[i] / tg << endl;
		delete[] d;
		delete[] v;
	}
}