#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <cstring>
#include <cstdio>
#define rep(i,n) for(int i = 0 ; i < n ; i++)
using namespace std;

long long gcd(long long a,long long b){
	return b ? gcd(b,a%b) : a;
}

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

int main(){
	ios_base::sync_with_stdio(false);
	int n;
	
	while(cin >> n && n){
		long long A[10],B[10] = {};
		long long l = 1;
		for(int i = 0 ; i < n ; i++){
			long long a,b,g;
			cin >> a >> b;
			g = gcd(a,b);
			a/=g;b/=g;
			l = lcm(l,b);
			A[i] = a;
			B[i] = b;
		}
		long long L = 1;
		for(int i = 0 ; i < n ; i++){
			long long a = A[i]*l/B[i];
			//cout << a << endl;
			B[i] = l;
			A[i] = a;
			L = lcm(a,L);
		}
		for(int i = 0 ; i < n ; i++){
			cout << L/A[i] << endl;
		}
		
	}
}