#include <iostream>
using namespace std;
#define N 10
#define TYPE long long
TYPE gdb(TYPE a,TYPE b){
  if( !b )return a;
  return gdb( b, a%b);
}
TYPE lcm(TYPE a,TYPE b){
  TYPE g = gdb(a,b);
  return a/ g * b;
}
int main(){
  TYPE n,d[N],v[N];
  while(cin>>n,n){
    TYPE t=1, g;

    for( int i=0;i<n;i++ ){
      cin >> d[i] >> v[i];
      t = lcm( v[i] * t, d[i] );
      t  /= v[i];
      g = i==0?d[i]:gdb(g, d[i]);
    }
    if( g!=1 ){
      for( int i=0;i<n;i++ )
	cout << 1 << endl;
    }else{
      for( int i=0;i<n;i++ )
	cout << (v[i]*t/d[i]) << endl;
    }

  }
  return 0;
}