#include <iostream>
#include <string>
#include <vector>
using namespace std;

long long GCD(long long a, long long b) {
    return a == 0 ? b : GCD(b % a, a);
}

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

int main() {
    int n;
    while (cin >> n, n) {
        vector<long long> d(n), v(n);
        for (int i=0; i<n; ++i) {
            cin >> d[i] >> v[i];
        }
        long long t = 1;
        for (int i=0; i<n; ++i) {
            t = LCM(t, v[i]);
        }
        for (int i=0; i<n; ++i) {
            d[i] *= t / v[i];
            v[i] = t;
        }
        long long u = 1;
        for (int i=0; i<n; ++i) {
            u = LCM(u, d[i]);
        }
        for (int i=0; i<n; ++i) {
            cout << u / d[i] << endl;
        }
    }
    return 0;
}