#include <iostream>
#define int unsigned long long
using namespace std;

int gcd(int a,int b){
	if(a < b) swap(a,b);
	while(b){
		a %= b;
		swap(a,b);
	}
	return a;
}

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

signed main(){
	int n;
	while(cin >> n,n){
		int d[10],v[10],ld = 1,lv = 1;
		for(int i = 0;i < n;i++) {
			cin >> d[i] >> v[i];
			ld = lcm(ld,d[i]);
			lv = lcm(lv,v[i]);
		}
		for(int i = 0;i < n;i++) {
			if(!i) lv = ld / d[i] * v[i];
			else lv = gcd(lv,ld / d[i] * v[i]);
		}
		for(int i = 0;i < n;i++) cout << ld / d[i] * v[i] / lv << endl;
	}
	return 0;
}