#include <iostream>
#include <algorithm>
using namespace std;

typedef unsigned long long int LL;
const int MAX_N = 10;

// aとbの最大公約数を返す(ユークリッドの互除法)
LL gcd(LL a, LL b){
    return (b == 0)? a : gcd( b , a%b ) ;
}

// aとbの最小公倍数を返す
LL lcm(LL a, LL b){
    return ( a / gcd(a,b) * b );
}

int main(){
	int n;
	while( cin >> n , n ){
		LL d[MAX_N], v[MAX_N];
		for(int i=0 ; i < n ; i++ ){
			cin >> d[i] >> v[i];
			LL a = gcd( d[i] , v[i] );
			d[i] = d[i] / a;
			v[i] = v[i] / a;
		}
		LL b = lcm( d[0] , d[1] );
		for(int i=2 ; i < n ; i++ ){
			b = lcm( b , d[i] );
		}
		LL f[MAX_N] = {0};
		for(int i=0 ; i < n ; i++ ){
			f[i] = v[i] * (b / d[i]);
		}
		LL c = gcd( f[0] , f[1] );
		for(int i=2 ; i < n ; i++ ){
			c = gcd( f[i] , c );
		}
		for(int i=0 ; i < n ; i++ ){
			cout << (f[i] / c) << endl;
		}
	}
}