#include<iostream>

typedef unsigned long long int ll;

ll gcd(ll a, ll b){
	return (b==0)?a:gcd(b,a%b);
}

int main(){
	ll d[10], v[10], m = 1, c = 1;
	int n;
	while(std::cin >> n, n){
		m = c = 1;
		for(int i=0;i<n;i++){
			std::cin >> d[i] >> v[i];
			int g = gcd(m, v[i]);
			m = (m * v[i]) / g;
		}
		for(int i=0;i<n;i++){
			d[i] *= m / v[i];
			int g = gcd(c, d[i]);
			c *= d[i] / g;
		}
		for(int i=0;i<n;i++){
			std::cout << c / d[i] << std::endl;
		}
	}
}