#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;

typedef map<int, int> mii;
typedef long long ll;

#define CR const &

mii gen(int x){
    map<int, int> res;
    for (int i = 2; i <= x; i++){
        if (x%i == 0){
            int c = 0;
            while (x%i == 0)x /= i, c++;
            res[i] = c;
        }
    }
    return res;
}

ll rev(mii CR x){
    ll res = 1;
    for (auto & p : x){
        ll a, b;
        tie(a, b) = p;
        assert(b >= 0);
        for (int i = 0; i < b; ++i) {
            res *= a;
        }
    }
    return res;
}

mii mul(mii a, mii CR b){
    for (auto & p : b){
        a[p.first] += p.second;
    }
    return a;
}

mii div(mii a, mii CR b){
    for (auto & p : b){
        a[p.first] -= p.second;
    }
    return a;
}

mii gcd(mii a, mii CR b){
    for (auto & p : b){
        a[p.first] = min(a[p.first], p.second);
    }
    return a;
}

mii lcm(mii a, mii CR b){
    for (auto & p : b){
        a[p.first] = max(a[p.first], p.second);
    }
    return a;
}

int main(int argc, char ** argv) {
    int n;
    while (cin >> n && n){
        mii d[20], v[20];
        mii l1;
        for (int i = 0; i < n; ++i) {
            ll dd, vv;
            cin >> dd >> vv;
            d[i] = gen(dd);
            v[i] = gen(vv);
            l1 = lcm(l1, v[i]);
        }
        mii l2;
        for (int i = 0; i < n; ++i) {
            l2 = lcm(l2, div(mul(d[i],l1) , v[i]));
        }
        for (int i = 0; i < n; ++i) {
            mii ans = div(mul(v[i], l2), mul(d[i], l1));
            cout << rev(ans) << endl;
        }
    }
}