// 2010/12/28 Tazoe

#include <iostream>
using namespace std;

unsigned long long gcd(unsigned long long m, unsigned long long n)
{
	if(n>m){
		unsigned long long tmp = m;
		m = n;
		n = tmp;
	}

	if(n==0)
		return m;

	while(true){
		if(m%n==0)
			return n;

		unsigned long long tmp = m%n;
		m = n;
		n = tmp;
	}
}

unsigned long long lcm(unsigned long long m, unsigned long long n)
{
	return m/gcd(m, n)*n;
}

int main()
{
	while(true){
		int n;
		cin >> n;
		if(n==0)
			break;

		unsigned long long d[10], v[10];
		for(int i=0; i<n; i++){
			cin >> d[i] >> v[i];
			unsigned long long g = gcd(d[i], v[i]);
			d[i] /= g;
			v[i] /= g;
		}

		unsigned long long D = lcm(d[0], d[1]);
		for(int i=2; i<n; i++)
			D = lcm(D, d[i]);

		for(int i=0; i<n; i++)
			v[i] = D/d[i]*v[i];

		unsigned long long V = gcd(v[0], v[1]);
		for(int i=2; i<n; i++)
			V = gcd(V, v[i]);

		for(int i=0; i<n; i++)
			cout << v[i]/V << endl;
	}

	return 0;
}