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

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

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

int main(){
  ll d[10],v[10];

  int n;
  while( cin >> n , n){
    for(int i = 0 ; i < n ; i++ ){
      cin >> d[i] >> v[i];
      ll G = gcd(d[i],v[i]);
      d[i]/=G;
      v[i]/=G;
    }
    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 vgc = v[0];
    for(int i = 1 ; i < n ; i++ ){
      vgc = gcd(vgc,v[i]);
    }
    for(int i = 0 ; i < n ; i++ ){
      cout << v[i]/vgc << endl;
    }
  }
  return 0;
}