/*
 * src.cpp
 *
 *  Created on: 2016/07/26
 *      Author: joi
 */

#include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)

const int MAX_N=10;

int n;
int d[MAX_N],v[MAX_N];

typedef long long ll;

ll g[MAX_N];

ll gcd(ll a,ll b){
	if (b==0) return a;
	return gcd(b,a%b);
}

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

int main(){
	do{
		cin>>n;
		if (n){
			REP(i,n){
				cin>>d[i]>>v[i];
			}
			REP(i,n-1){
				ll a,b;
				a=d[0]*v[i+1];
				b=d[i+1]*v[0];
				g[i]=b/gcd(a,b);
			}
			for (int i=n-3;i>=0;i--){
				g[i]=lcm(g[i],g[i+1]);
			}
			cout<<g[0]<<endl;
			FOR(i,1,n){
				cout<<d[0]*v[i]*g[0]/v[0]/d[i]<<endl;
			}
		}
	}while(n);
	return 0;
}