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

ll gcd(ll a,ll b){return (!b)?a:gcd(b,a%b);}
ll lcm(ll a,ll b){return a/gcd(a,b)*b;}

int main(){
  ll n,d[10],v[10];
  while(cin >> n,n){
    for(int i=0;i<n;i++)cin >> d[i] >> v[i];
    ll V = 1;
    for(int i=0;i<n;i++)V = lcm(V,v[i]);
    ll D = 1;
    for(int i=0;i<n;i++)D = lcm(D,V/v[i]*d[i]);
    
    for(int i=0;i<n;i++){
      cout << (D/d[i])/(V/v[i]) << endl;
    }
  }
}