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

typedef long long ll;

ll gcd(ll a, ll b){
    return a ? gcd(b%a, a) : b;
}

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

int main(int argc, char ** argv) {
    int n;
    while (cin >> n && n){
        ll d[20], v[20];
        ll l1 = 1;
        for (int i = 0; i < n; ++i) {
            cin >> d[i] >> v[i];
            l1 = lcm(l1, v[i]);
        }
        ll l2 = 1;
        for (int i = 0; i < n; ++i) {
            l2 = lcm(l2, d[i] * l1 / v[i]);
        }
        for (int i = 0; i < n; ++i) {
            cout << l2 / (l1*d[i] / v[i]) << endl;
        }
    }
}