#include <iostream>
#include <algorithm>
#include <vector>

using namespace std;

#define ll long long

ll gcd(ll a, ll b){
	return b==0?a:gcd(b,a%b);
}

ll lcm(ll a, ll b){
	return a*b/gcd(a,b);
}

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