#include <iostream>
using namespace std;
typedef long long ll;

#define lcm(a,b) (a / gcd(a,b) * b)

ll gcd(ll a,ll b){ return b ? gcd(b,a%b) : a; }
ll d[10],v[10],t[10];
int n;

int main(){
	while(cin >> n , n){
		ll g = 1;
		for(int i = 0 ; i < n ; i++)
			cin >> d[i] >> v[i] ;
		ll V = v[0];	
		for(int i = 1 ; i < n ; i++)
			V = lcm(V,v[i]);
		for(int i = 0 ; i < n ; i++)
			d[i] *= V / v[i];
		ll D = d[0];
		for(int i = 1 ; i < n ; i++)
			D = lcm(D,d[i]);
		for(int i = 0 ; i < n ; i++)
			cout << D/d[i] << endl;
		
	}
}