#include <bits/stdc++.h>

using namespace std;

typedef long long lint;

lint gcd(lint x, lint y){ return __gcd(x, y); }
lint lcm(lint x, lint y){ return x / gcd(x, y) * y; }

int main()
{
	int n;
	while (cin >> n, n){
		vector<pair<lint, lint> > ss;
		lint l = 1;
		for (int i = 0; i < n; i++){
			lint d, v;
			cin >> d >> v;
			lint g = gcd(d, v);
			l = lcm(l, d / g);
			ss.push_back(make_pair(d, v));
		}
		lint g = l * ss[0].second / ss[0].first;
		for (int i = 1; i < n; i++){
			g = gcd(l * ss[i].second / ss[i].first, g);
		}
		for (int i = 0; i < n; i++){
			cout << l * ss[i].second / ss[i].first / g << endl;
		}
	}
	return (0);
}