#include<iostream>
#include<vector>
#include<string>
#include<cstdio>
#define int long long
#define P pair<int,int>
using namespace std;

int gcd(int a, int b) {
	if (b == 0)return a;
	return gcd(b, a%b);
}
int lcm(int a, int b) {
	return a*b / gcd(a, b);
}
signed main() {
	int a;
	P b[10];
	while (scanf("%lld", &a), a) {
		int LCM = 1;
		for (int c = 0; c < a; c++) {
			int d, e;
			scanf("%lld%lld", &d, &e);
			int f = gcd(d, e);
			b[c] = P(d / f, e / f);
			LCM = lcm(LCM, d / f);
		}
		for (int x = 0; x < a; x++) {
			printf("%lld\n", LCM*b[x].second / b[x].first);
		}
	}
}