#include<iostream>
#include<algorithm>
using namespace std;
#define reps(i,n) for(int i = 0 ; i < (n) ; ++i )
#define rep(i,a,n) for(int i = (a) ; i < (n) ; ++i)
typedef long long ll;
int main(){
  int n;
  while(cin >> n , n){
    ll d[n] , v[n];
    reps(i,n) cin >> d[i] >> v[i];
    ll a = d[0];
    rep(i,1,n) a = d[i]*a / __gcd(d[i],a);
    ll b[n];
    reps(i,n) b[i] = v[i] * a / d[i];
    ll c = b[0];
    rep(i,1,n) c = __gcd(c,b[i]);
    reps(i,n) cout << b[i] / c << endl;;
  }
}