// siquareさんのを参考
// http://siquare.hatenablog.com/entry/2012/04/21/121224
#include <iostream>
#include <cstring>
#include <algorithm>

using namespace std;

typedef long long ll;

inline ll lcm(ll a, ll b)
{
    return a / __gcd(a, b) * b;
}

int main()
{
    int n;

    while (cin >> n, n) {
        ll d[n], v[n];

        for (int i = 0; i < n; ++i) {
            cin >> d[i] >> v[i];
            int gd = __gcd(d[i], v[i]);
            d[i] /= gd;
            v[i] /= gd;
        }

        ll gv = __gcd(v[0], v[1]), ld = lcm(d[0], d[1]);
        for (int i = 2; i < n; ++i) {
            gv = __gcd(gv, v[i]);
            ld = lcm(ld, d[i]);
        }

        for (int i = 0; i < n; ++i)
            cout << ld * v[i] / gv / d[i] << endl;
    }

    return 0;
}