#include <iostream>

using namespace std;

unsigned long gcm(unsigned long int x, unsigned long int y) {
	unsigned long int z;
	while (y) {
		z = y;
		y = x % y;
		x = z;
	}
	return x;
}

int main () {
    unsigned long int n;
    while (cin >> n, n) {
		unsigned long int d[11], v[11], z;
		for (int i = 0; i < n; ++i) {
			cin >> d[i] >> v[i];
			z = gcm(d[i], v[i]);
			d[i] /= z, v[i] /= z;
		}
		v[10] = v[0];
		for (int i = 1; i < n; ++i)
			v[10] *= v[i] / gcm(v[10], v[i]);

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

		d[10] = d[0];
		for (int i = 1; i < n; ++i)
			d[10] *= d[i] / gcm(d[10], d[i]);

		for (int i = 0; i < n; ++i)
			cout << (d[10] / d[i]) << endl;

		cout << d[10] << endl;
    }
}