#include <iostream>
#include <cmath>
#include <queue>
#include <vector>
#include <functional>

using namespace std;

long long int gcd(long long int a, long long int b) {
	if (b == 0) {
		return a;
	} else {
		return gcd(max(b, a%b), min(b, a%b));
	}
}

long long int lcm(long long int a, long long int b) {
	return a * b / gcd(a, b);
}

typedef pair<long long int, long long int> P;

int main() {
	int n;
	while (cin >> n) {
		if (n == 0) {
			break;
		}
		long long int t = 1;
		vector<long long int> d(n);
		vector<long long int> v(n);
		for (int i = 0; i < n; i++) {
			cin >> d[i] >> v[i];
			t = lcm(max(v[i]*t, d[i]), min(v[i]*t, d[i])) / v[i];
			//cout << t << endl;
		}
		long long int a = v[0]*t/d[0];
		for (int i = 0; i < n; i++) {
			a = gcd(a, v[i]*t/d[i]);
		}
		for (int i = 0; i < n; i++) {
			cout <<(v[i]*t/d[i])/a << endl;
		}
	}
	return 0;
}