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

typedef pair<long long, long long> pl;

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;
}

void reduce(pl &a) {
    long long t = gcd(a.first, a.second);
    a.first /= t;
    a.second /= t;
}

pl lcm(pl a, pl b) {
    long long k = a.second, l = b.second;
    a.first *= l; a.second *= l;
    b.first *= k; b.second *= k;
    pl ret(a.first / gcd(a.first, b.first) * b.first, a.second);
    reduce(ret);
    return ret;
}

int main() {
    int n;
    while (cin >> n, n) {
        vector<long long> d(n), v(n);
        pl t;
        for (int i=0; i<n; ++i) {
            cin >> d[i] >> v[i];
            if (i == 0) {
                t = pl(d[i], v[i]);
            } else {
                t = lcm(t, pl(d[i], v[i]));
            }
        }
        for (int i=0; i<n; ++i) {
            cout << (t.first * v[i]) / (d[i] * t.second) << endl;
        }
    }
    return 0;
}