#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

typedef long long int ll;

ll lcm(ll a,ll b){
    if(a<b)swap(a, b);
    ll gcd=a%b;
    ll x=a*b;
    while (gcd!=0) {
        a=b;
        b=gcd;
        gcd=a%b;
    }
    return x/b;
}

ll gcd(ll a,ll b){
    ll gcd=a%b;
    while (gcd!=0) {
        a=b;
        b=gcd;
        gcd=a%b;
    }
    return b;
}

int main(){
    int n;
    while (1) {
        cin>>n;
        if(n==0)break;
        vector<pair<ll, ll> >dv(n);
        int d,v;
        for (int i=0; i<n; i++) {
            cin>>d>>v;
            ll r=gcd(d,v);
            d/=r;
            v/=r;
            dv[i]=make_pair(d, v);
        }
        ll l=dv[0].first;
        for (int i=0; i<n-1; i++) {
            l=lcm(l, dv[i+1].first);
        }
        ll a[n];
        for (int i=0; i<n; i++) {
            a[i]=l*dv[i].second/dv[i].first;
        }
        ll g=gcd(a[0],a[1]);
        for (int i=2; i<n; i++) g=gcd(g, a[i]);
        for (int i=0; i<n; i++) cout<<a[i]/g<<endl;
    }
    return 0;
}
