#define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
#include<stack>
#include<functional>
#include<sstream>
using namespace std;
typedef long long ll;

ll GCD(ll a, ll 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 N;
	while(cin >> N, N)
	{
		ll d[10], v[10], gcdV = 0, lcmD = 1;
		for(int i = 0; i < N; i++)
		{
			cin >> d[i] >> v[i];
			ll gcd = GCD(d[i], v[i]);
			d[i] /= gcd;
			v[i] /= gcd;
			lcmD = LCM(lcmD, d[i]);
			gcdV = GCD(gcdV, v[i]);
		}
		for(int i = 0; i < N; i++)
		{
			printf("%lld\n", v[i] / gcdV * (lcmD / d[i]));
	}
	}
}