#include <iostream>
#include <vector>
#include <utility>

using namespace std;

long long int gcd(long long int, long long int);
//long long int lcm(long long int, long long int);

int main(){
	int n;
	while (cin >> n, n) {
		vector<int> d(n), v(n);
		for (int i = 0; i < n; i++) {
			cin >> d[i] >> v[i];
		}
		pair<long long int, long long int> cur = make_pair(d[0], v[0]);
		for (int i = 1; i < n; i++) {
			long long int A = cur.first * v[i],
						  B = cur.second * d[i];
			if (A == B) {continue;} 
			else if (cur.second > v[i]) {cur.first = (A / gcd(A, B)) * d[i]; cur.second = v[i];}
			else {cur.first = (B / gcd(A, B)) * d[i];}
		}
		for (int i = 0; i < n; i++) {
			cout << (cur.first * v[i]) / (cur.second * d[i]) << endl;	
		}
	}
	return 0;
}

long long int gcd(long long int a, long long int b){
	while (a != b) {
		if (a > b) {
			a = a - b;	
		} else {
			b = b - a;	
		}	
	}
	return a;
	/*
	if (a == b) return a;
	else {
		if (a > b) {
			return gcd(a - b, b);	
		} else {
			return gcd(b - a, a);	
		}	
	}
	*/
}

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

pair<long long int, long long int> func(pair<long long int, long long int> a, pair<long long int, long long int> b){
	long long int A = a.first * b.second, 
		   B = a.second * b.first;
	if (A == B) {
		if (a.second > b.second) {return make_pair(b.first, b.second);}
		else {return make_pair(a.first, a.second);}
	} else {
		if (a.second > b.second){
			return make_pair((A / gcd(A, B)) * b.first, b.second);	
		} else {
			return make_pair((B / gcd(A, B)) * a.first, a.second);	
		}
	}
}