#include<iostream>
#include<algorithm>
#include<stdint.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define MAX 20
using namespace std;

int n;
uint64_t d[MAX],v[MAX];

int main()
{
 
  while(cin >> n,n)
    {
      uint64_t LCM,GCD;
      rep(i,n)
	{
	  cin >> d[i] >> v[i];
	  uint64_t div = __gcd(d[i],v[i]);
	  d[i] /= div, v[i] /= div;
	  GCD = (i==0?v[i]:__gcd(GCD,v[i]));
	  LCM = (i==0?d[i]:d[i]/__gcd(d[i],LCM)*LCM);
	}

      rep(i,n)cout << (uint64_t)((LCM/d[i])*(v[i]/GCD)) << endl;

    }
  return 0;
}