#include<bits/stdc++.h>
using namespace std;
#define int unsigned long long
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define all(C) (C).begin(),(C).end()
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(){
    rep(i,n){
        cin>>d[i]>>v[i];
        int g=gcd(d[i],v[i]);
        d[i]/=g;v[i]/=g;
    }
    int base=d[0];
    rep(i,n)base=lcm(base,d[i]);
    rep(i,n)v[i]*=(base/d[i]);
    base=v[0];
    rep(i,n)base=gcd(base,v[i]);
    rep(i,n)cout<<v[i]/base<<endl;
}
signed main(){
    cin.tie(0);ios_base::sync_with_stdio(0);
    while(cin>>n&&n)solve();
    return 0;
}