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

typedef array<int,10000> Int;
typedef long long ll;

#define CR const &

Int gen(int x){
    Int res;
    res.fill(0);
    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(Int CR x){
    ll res = 1;
    for (int i = 0; i < 10000; ++i) {
        for (int j = 0; j < x[i]; ++j) {
            res *= i;
        }
    }
    return res;
}

Int mul(Int a, Int CR b){
    for (int i = 0; i < 10000; ++i) {
        a[i] += b[i];
    }
    return a;
}

Int div(Int a, Int CR b){
    for (int i = 0; i < 10000; ++i) {
        a[i] -= b[i];
    }
    return a;
}

Int gcd(Int a, Int CR b){
    for (int i = 0; i < 10000; ++i) {
        a[i] = min(a[i], b[i]);
    }
    return a;
}

Int lcm(Int a, Int CR b){
    for (int i = 0; i < 10000; ++i) {
        a[i] = max(a[i], b[i]);
    }
    return a;
}

Int d[20], v[20];

int main(int argc, char ** argv) {
    int n;
    while (cin >> n && n){
        Int l1;
        l1.fill(0);
        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]);
        }
        Int l2;
        l2.fill(0);
        for (int i = 0; i < n; ++i) {
            l2 = lcm(l2, div(mul(d[i],l1) , v[i]));
        }
        for (int i = 0; i < n; ++i) {
            Int ans = div(mul(v[i], l2), mul(d[i], l1));
            cout << rev(ans) << endl;
        }
    }
}