#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;

typedef map<long long,int> U;

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;
}

U factor(long long N){
	U p;
	for(int i = 2 ; i * i <= N ; i++){	
		while(N%i==0)p[i]++,N/=i;
	}
	if( N != 1 ) p[N]++;
	return p;
}
U gcd(U a,U b){
	U c;
	for( U::iterator it = a.begin() ; it != a.end() ; ++it){
		if( b.count(it->first) ) continue;
		c[it->first] = min(it->second,b[it->first]);
	}
	return c;
}
U lcm(U a,U b){
	U c;
	for( U::iterator it = a.begin() ; it != a.end() ; ++it){
		c[it->first] = max(c[it->first],it->second);
	}
	for( U::iterator it = b.begin() ; it != b.end() ; ++it){
		c[it->first] = max(c[it->first],it->second);
	}
	return c;
}
U mul(U a,U b){
	for( U::iterator it = a.begin() ; it != a.end() ; ++it){
		b[it->first] += it->second;
	}
	return b;
}
U div(U a,U b){
	for( U::iterator it = b.begin() ; it != b.end() ; ++it){
		a[it->first] -= it->second;
	}
	return a;
}
long long conv(U a){
	long long res = 1;
	for( U::iterator it = a.begin() ; it != a.end() ; ++it){
		for(int j = 0 ; j < it->second ; j++) res *= it->first;
	}
	return res;
}
int main(){
	ios_base::sync_with_stdio(false);
	int n;
	
	while(cin >> n && n){
		U  A[10],B[10] = {};
		U l;
		for(int i = 0 ; i < n ; i++){
			long long a_,b_;
			cin >> a_ >> b_;
			U a = factor(a_);
			U b = factor(b_);
			U g = gcd(a,b);
			a=div(a,g);
			b=div(b,g);
			l = lcm(l,b);
			A[i] = a;
			B[i] = b;
		}
		U L;
		for(int i = 0 ; i < n ; i++){
			U a = div(mul(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 << conv(div(L,A[i])) << endl;
		}
		
	}
}