#include <bits/stdc++.h>
using namespace std;

using ll = long long;

ll gcd(ll a, ll b) {
    if(b == 0) {
        return a;
    }
    return gcd(b, a % b);
}

ll lcm(ll a, ll b) {
    int g = gcd(a, b);
    a /= g;
    b /= g;
    return a * b * g;
}

int main() {
    int n;
    while(cin >> n, n) {
        vector<int> d(n), v(n);
        for(int i=0; i<n; ++i) {
            cin >> d[i] >> v[i];
            int g = gcd(d[i], v[i]);
            d[i] /= g;
            v[i] /= g;
        }
        ll l = d[0], g = v[0];
        for(int i=1; i<n; ++i) {
            l = lcm(l, d[i]);
            g = gcd(g, v[i]);
        }
        for(int i=0; i<n; ++i) {
            cout << l * v[i] / d[i] / g << endl;
        }
    }
}
