#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<cmath>
#include<cstring>
#include<queue>
#include<cstdio>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e9;
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
ll gcd(ll a,ll b){
	return (b==0?a:gcd(b,a%b));
}
ll lcm(ll a,ll b){
	return a/gcd(a,b)*b;
}
int main(){
	int n;
	while(cin>>n,n){
		vi a(n),b(n);
		rep(i,n)cin>>a[i]>>b[i];
		rep(i,n){
			ll t=gcd(a[i],b[i]);
			a[i]/=t;b[i]/=t;
		}
		ll g=b[0],l=a[0];
		loop(i,1,n){
			g=gcd(g,b[i]);
			l=lcm(l,a[i]);
		}
		rep(i,n)cout<<l/a[i]*(b[i]/g)<<endl;;
	}
}