#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <vector>
#include <map>
#include <set>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>

#define REP(i,n) for(auto i=0;i<n;++i)
#define REPR(i,n) for(auto i=n;i>=0;--i)
#define REPI(itr,v) for(auto itr=v.begin();itr!=v.end();++itr)
#define REPIR(itr,v) for(auto itr=v.rbegin();itr!=v.rend();++itr)
#define FOR(i,a,b) for(auto i=a;i<b;++i)
#define SORT(v,n) sort(v, v+n)
#define SORTV(v) sort(v.begin(), v.end())
#define ALL(v) v.begin(),v.end()
#define llong long long
#define ll long long
#define INF 999999999
#define MOD 1000000007
#define pb push_back
#define pf push_front
#define MP make_pair
#define SV(n,v) {int tmp;for(int i=0;i<n;++i){scanf("%d",&tmp);v.push_back(tmp);}}

int dx[] = {0, 0, -1, 1};
int dy[] = {1, -1, 0, 0};

using namespace std;

typedef pair<int,int> pii;

llong gcd(llong a, llong b);

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

llong gcd(llong a, llong b){
  if(b > a) swap(a,b);

  llong r = a % b;
  if(r == 0) return b;

  return gcd(b, r);
}

int main(){

  int n;
  while(true){
    scanf("%d", &n);

    if(n == 0) break;

    vector<llong> d(n), v(n);
    REP(i,n){
      scanf("%lld %lld", &d[i], &v[i]);
      llong tmp = gcd(d[i], v[i]);
      d[i] /= tmp; v[i] /= tmp;
    }

    llong D = d[0], V = v[0];
    FOR(i,1,n){
      D = lcm(D, d[i]); V = gcd(V, v[i]);
    }

    REP(i,n){
      printf("%lld\n", D * v[i] / V / d[i]);
    }

  
  }

  return 0;
}


