#include <iostream>
#include <algorithm>

using namespace std;
typedef long long int ll;

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

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

int main(){
  ll n;
  while(cin >> n , n){

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

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

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

    ll vlc = v[0];
    for(int i = 1 ; i < n ; i++ ){
      vlc = gcd(vlc,v[i]);
    }
    for(int i = 0 ; i < n ; i++ )cout << v[i]/vlc << endl;

  }
  return 0;
}