#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<eps)
ll d[20],v[20];
ll ans[20];
void add(int k,ll x,ll y)
{
	if(k==1)
	{
		ans[k-1]=x;
		ans[k]=y;
		return;
	}
	ll g=__gcd(ans[k-1],x);
	//cout << "g :"<<  g << endl;
	ans[k]=y*(ans[k-1]/g);
	for(int i=0;i<k;i++)ans[i]*=(x/g);
}
int main()
{
	while(1)
	{
		int n;
		cin >> n;
		if(n==0)break;
		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;
		}
		for(int i=1;i<n;i++)
		{
			ll A,B;
			A=d[i]*v[i-1];
			B=d[i-1]*v[i];
			ll G=__gcd(A,B);
			A/=G;
			B/=G;
			//cout << A << ' ' << B << endl;
			add(i,A,B);
		}
		for(int i=0;i<n;i++)printf("%lld\n",ans[i]);
		//for(int i=0;i<n;i++)printf("%lld\n",ans[i]/v[i]*d[i]);
	}
	return 0;
}