#include <iostream>
#include <fstream>
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cmath>
#include <complex>
#include <cstdio>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;

ll n,d[10],v[10],ans;

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


int main(){
	while(cin>>n&&n){
		rep(i,n)cin>>d[i]>>v[i];
		ll l=1;
		rep(i,n-1)l*=d[i+1]*v[0]/gcd(d[0]*l*v[i+1],d[i+1]*v[0]);
		rep(i,n)cout<<l*d[0]*v[i]/d[i]/v[0]<<endl;
	}
}