#include<bits/stdc++.h>
using namespace std;
#define int unsigned long long
#define rep(i,n) for(int i=0;i<(int)(n);i++)
const int MAX=10;
int n;
int d[MAX],v[MAX];

int gcd(int a,int b){
    return b?gcd(b,a%b):a;
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}

void solve(){
    int l=1;
    int latte=1;
    int malta=0;
    rep(i,n){
        cin>>d[i]>>v[i];
        int g=gcd(d[i],v[i]);
        d[i]/=g;v[i]/=g;
        l=lcm(l,v[i]);
    }
    rep(i,n){
        d[i]*=l/v[i];
        malta=gcd(malta,d[i]);
    }
    rep(i,n){
        d[i]/=malta;
        latte=lcm(latte,d[i]);
    }
    rep(i,n)cout<<latte/d[i]<<endl;
}
signed main(){
    cin.tie(0);ios_base::sync_with_stdio(0);
    while(cin>>n&&n)solve();
    return 0;
}