#include <iostream>
#include <algorithm>

using namespace std;
typedef long long int ll;

ll gcd(ll a,ll b){
  if(a < b)swap(a,b);
  if(b == 0)return a;
  gcd(b,a%b);
}

ll lcm(ll a,ll b){
  if(a < b)swap(a,b);
  return (a/gcd(a,b))*b;
}
int main(){
  ll n;
  while(cin >> n , n){

    ll d[n],v[n];
    for(int i = 0 ; i < n ; i++ ){
      cin >> d[i] >> v[i];
    }

    ll dlc = d[0],vlc = v[0];
    for(int i = 1 ; i < n ; i++ ){
      dlc = lcm(dlc,d[i]);
      vlc = lcm(vlc,v[i]);
    }

    ll dd[n];
    for(int i = 0 ; i < n ; i++ ){
      dd[i] = (d[i]*vlc)/v[i];
      }

    ll ddlc = dd[0];
    for(int i = 1 ; i < n ; i++ ){
      ddlc = lcm(ddlc,dd[i]);
    }

    for(int i = 0 ; i < n ; i++ )cout << ddlc/dd[i] << endl;

  }
  return 0;
}