#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <sstream>
#include <cmath>
#include <queue>

using namespace std;

long long int dist_origin[20], dist[20], laps[20];

long long int GCD(long long int a, long long int b){
	long long int dummy1, dummy2, dummy;
	dummy1 = max(a, b);
	dummy2 = min(a, b);
	while(true){
		dummy = dummy1 % dummy2;
		dummy1 = dummy2;
		dummy2 = dummy;
		if(dummy == 0){
			break;
		}
	}
	return dummy1;
}

int main(){
	
	int n;
	
	while(true){
		cin >> n;
		if(n == 0){
			break;
		}
		for(int i = 0; i < n; i++){
			cin >> dist_origin[i] >> laps[i];
			dist[i] = dist_origin[i];
		}
		for(int i = 0; i < n - 1; i++){
			long long int gcd = GCD(dist[i] * laps[i + 1], dist[i + 1] * laps[i]);
			long long int hoge = dist[i + 1];
			dist[i + 1] *= dist[i] * laps[i + 1] / gcd;
			for(int j = 0; j <= i; j++){
				dist[j] *= hoge * laps[i] / gcd;
			}
		}
		
		for(int i = 0; i < n; i++){
			long long int ans = dist[i] / dist_origin[i];
			cout << ans << endl;
		}
		
	}
	
	return 0;
}