#include <cmath>
#include <cstdio>
#include <algorithm>

using namespace std;

typedef long long lint;

lint gcd(lint a, lint b)
{
	return (!b ? a : gcd(b, a % b));
}

lint lcm(lint a, lint b)
{
	if (a < b) swap(a, b);
	return (a / gcd(a, b) * b);
}

int main()
{
	int n;
	lint v[16], d[16], a[16];
	
	while (scanf("%d", &n) && n){
		lint dl = 1;
		lint common;
		for (int i = 0; i < n; i++){
			scanf("%lld %lld", d + i, v + i);
			common = gcd(d[i], v[i]);
			d[i] /= common; v[i] /= common;
			dl = lcm(dl, d[i]);
		}
		
		common = dl / d[0] * v[0];
		for (int i = 0; i < n; i++){
			a[i] = dl / d[i] * v[i];
			common = gcd(common, a[i]);
		}
		
		for (int i = 0; i < n; i++){
			printf("%lld\n", a[i] / common);
		}
	}
	
	return (0);
}