#include <iostream>
using namespace std;
long long gcd(long long a,long long b){
  return b?gcd(b,a%b):a;
}

int main(){
  int n;
  while(1){
    cin >> n;
    if(n==0) break;
    long long d[10],v[10];
    for(int i=0;i<n;i++){
      cin >> d[i] >> v[i];
   }
    long long d_all=d[0],v_all=v[0];
    for(int i=1;i<n;i++){
      d_all = ( d[i]*v_all / gcd(d_all*v[i], d[i]*v_all) ) * d_all;
    }
    for(int i=0;i<n;i++){
      cout << d_all * v[i] / v_all / d[i] << "\n";
   }
  }
}