#include <iostream>
using namespace std;

unsigned long long _gcd(unsigned long long m, unsigned long long n) {
    if (m == 0) return n;
    return _gcd(n % m, m);
}

unsigned long long gcd(unsigned long long m, unsigned long long n) {
    if (m < n) return _gcd(m, n);
    else return _gcd(n, m);
}

unsigned long long lcm(unsigned long long m, unsigned long long n) {
    if (m > n)
        return m * n / _gcd(n, m);
    return m * n / _gcd(m, n);
}


int main() {
    int n, i;

    while (cin >> n, n) {
        unsigned long long d[n], v[n];
        unsigned long long dm, vd;
        dm = 1;
        for (i = 0; i < n; i++) {
            cin >> d[i] >> v[i];
            dm = lcm(dm, d[i]);
        }
        for (i = 0; i < n; i++) {
            v[i] = v[i] * dm / d[i];
            // cout << "v/d: " << v[i] << "/" << dm << endl;
        }
        vd = v[0];
        for (i = 1; i < n; i++) {
            vd = gcd(vd, v[i]);
        }
        for (i = 0; i < n; i++) {
            cout << v[i] / vd << endl;
        }
    }
    return 0;
}