#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <stack>
#include <queue>

using namespace std;

unsigned long long int GCD(unsigned long long int a, unsigned long long int b)
{
	if (b == 0)
	{
		return(a);
	}
	if (a < b)
	{
		return(GCD(b, a));
	}
	return(GCD(b, a % b));
}

unsigned long long int LCM(unsigned long long int a, unsigned long long int b)
{
	unsigned long long int gcd = GCD(a, b);
	return(a * b / gcd);
}

void solve()
{
	int n;
	while (cin >> n, n)
	{
		vector<unsigned long long int> d(n);
		vector<unsigned long long int> v(n);
		for (int i = 0; i < n; ++i)
		{
			cin >> d[i] >> v[i];
		}
		unsigned long long int lcm = 1;
		vector<unsigned long long int> T(n);
		for (int i = 0; i < n; ++i)
		{
			T[i] = LCM(d[i], v[i]) / v[i];
		}
		unsigned long long int lcmT = T[0];
		unsigned long long int gcdV = v[0];
		for (int i = 1; i < n; ++i)
		{
			lcmT = LCM(lcmT, T[i]);
			gcdV = GCD(gcdV, v[i]);
		}
		for (int i = 0; i < n; ++i)
		{
			cout << v[i] * lcmT / d[i] / gcdV << endl;
		}
	}
}

int main()
{
	solve();
	return(0);
}