
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;

struct data{
  ll d,v,z,ans;
  void c(){
    ll x = __gcd(d,v);
    d/=x;
    v/=x;
  }
};

int n;
data t[10];

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

ll gcd(ll a,ll b){
  return __gcd(a,b);
}

int main(){

  while(cin>>n&&n){
    ll y=1;
    for(int i=0;i<n;i++){
      cin>>t[i].d>>t[i].v;
      t[i].c();
      t[i].z=t[i].d;
      y=lcm(y,t[i].v);
    }

    for(int i=0;i<n;i++){
      t[i].d*=y;
      t[i].c();
      //cout<<t[i].d<<' '<<t[i].v<<endl;
    }

    ll m = t[0].v;
    for(int i=0;i<n;i++){
      m= lcm(m,t[i].d);
    }
    
    for(int i=0;i<n;i++){
      cout<<m/t[i].d<<endl;
    }
    


  }
  return 0;
}