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

ll GCD(ll a, ll b) {
	return b ? GCD(b, a % b) : a;
}

ll LCM(ll a, ll b) {
	return a / GCD(a, b) * b;
}

int main()
{
	ll n;
	while (cin >> n, n) {
		vector<ll> d(n), v(n);
		for (int i = 0; i < n; i++) {
			cin >> d[i] >> v[i];
			ll gcd = GCD(d[i], v[i]);
			d[i] /= gcd;
			v[i] /= gcd;
		}
		vector<ll> res(n);
		ll lcm = d[0], gcd = v[0];
		for (int i = 1; i < n; i++) {
			lcm = LCM(lcm, d[i]);
			gcd = GCD(gcd, v[i]);
		}
		for (int i = 0; i < n; i++) {
			cout << lcm * v[i] / d[i] / gcd << endl;
		}
	}
	return 0;
}