#include <iostream>
using namespace std;
int n; long long p[10], q[10];
long long gcd(long long x, long long y) {
	return y ? gcd(y, x % y) : x;
}
int main() {
	while(cin >> n, n) {
		for(int i = 0; i < n; i++) {
			cin >> p[i] >> q[i];
			int r = gcd(p[i], q[i]); p[i] /= r, q[i] /= r;
		}
		long long s = 1;
		for(int i = 0; i < n; i++) s = s / gcd(s, q[i]) * q[i];
		for(int i = 0; i < n; i++) p[i] *= s / q[i]; s = 1;
		for(int i = 0; i < n; i++) s = s / gcd(s, p[i]) * p[i];
		for(int i = 0; i < n; i++) cout << s / p[i] << endl;
	}
}