#include<iostream>
#include<string>
#include<vector>
#include<set>
#include<list>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<unordered_map>
#include<set>
#define int long long
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);
}
int b[10], c[10];//???????????????
signed main() {
	int a;
	while (cin >> a, a) {
		for (int d = 0; d < a; d++) {
			int e, f; cin >> e >> f;
			e /= gcd(e, f); f /= gcd(e, f);
			b[d] = e; c[d] = f;
		}
		int LCM = 1;
		for (int d = 0; d < a; d++) {
			LCM = lcm(LCM, b[d]);
		}
		for (int d = 0; d < a; d++) {
			cout << c[d] * LCM/b[d] << endl;
		}
	}
}