#include "bits/stdc++.h"
#include<unordered_map>
#include<unordered_set>
#pragma warning(disable:4996)
using namespace std;
using ld = long double;
const ld eps = 1e-9;

//// < "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\a.txt" > "d:\d_download\visual studio 2015\projects\programing_contest_c++\debug\b.txt"

long long int gcd(long long int l, long long int r) {
	assert(l > 0 && r > 0);
	if (l > r)return gcd(r, l);
	else {
		const long long int num = r%l;
		if (num) {
			return gcd(l, num);
		}
		else {
			return l;
		}
	}
}
long long int lca(long long int l, long long int r) {
	return l / gcd(l, r)*r;
}

int main() {
	while (1) {
		int N; cin >> N;
		if (!N)break;
		if (!N)break;
		vector<long long int>ds(N), vs(N);
		for (int i = 0; i < N; ++i) {
			long long int d, v; cin >> d >> v;
			long long int agcd(gcd(d, v));
			d /= agcd; v /= agcd;
			ds[i] = d; vs[i] = v;
		}
		for (int i = 0; i < N; ++i) {
			for (int j = 0; j < N; ++j) {
				if (i == j)continue;
				ds[i] *= vs[j];
			}
		}
		long long int alca = 1;
		for (int i = 0; i < N; ++i) {
			alca = lca(alca, ds[i]);
		}
		for (int i = 0; i < N; ++i) {
			cout << alca / ds[i] << endl;
		}
	}
	
	return 0;
}