Go: package main

import (
	"bufio"
	"os"
	"strconv"
	"strings"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	for scanner.Scan() {
		n, _ := strconv.Atoi(scanner.Text())
		if n == 0 {
			break
		}
		d, v := make([]int, 0), make([]int, 0)
		for i := 0; i < n; i++ {
			scanner.Scan()
			buf := strings.Split(scanner.Text(), " ")
			a, _ := strconv.Atoi(buf[0])
			b, _ := strconv.Atoi(buf[1])
			g := _gcd(a, b)
			a /= g
			b /= g
			d = append(d, a)
			v = append(v, b)
		}
		g := lcm(n, d)
		for i := 0; i < n; i++ {
			d[i] = (g/d[i])*v[i]
		}
		g = gcd(n, d)
		for i := 0; i < n; i++ {
			fmt.Println(d[i]/g)
		}
	}
}

func _gcd(a, b int) int {
	for b != 0 {
		r := a % b
		a, b = b, r
	}
	return a
}

func gcd(n int, a []int) int {
	if n == 1 {
		return a[0]
	}
	g := _gcd(a[0], a[1])
	for i := 2; i < n; i++ {
		if g == 1 {
			break
		}
		g = _gcd(g, a[i])
	}
	return g
}

func lcm(n int, a []int) int {
	if n == 1 {
		return a[0]
	}
	g := _gcd(a[0], a[1])
	c := a[0] / g * a[1]
	for i := 2; i < n; i++ {
		g = _gcd(c, a[i])
		c = c / g * a[i]
	}
	return c
}

C++: // 2010/12/28 Tazoe

#include <iostream>
using namespace std;

unsigned long long gcd(unsigned long long m, unsigned long long n)
{
	if(n>m){
		unsigned long long tmp = m;
		m = n;
		n = tmp;
	}

	if(n==0)
		return m;

	while(true){
		if(m%n==0)
			return n;

		unsigned long long tmp = m%n;
		m = n;
		n = tmp;
	}
}

unsigned long long lcm(unsigned long long m, unsigned long long n)
{
	return m/gcd(m, n)*n;
}

int main()
{
	while(true){
		int n;
		cin >> n;
		if(n==0)
			break;

		unsigned long long d[10], v[10];
		for(int i=0; i<n; i++){
			cin >> d[i] >> v[i];
			unsigned long long g = gcd(d[i], v[i]);
			d[i] /= g;
			v[i] /= g;
		}

		unsigned long long D = lcm(d[0], d[1]);
		for(int i=2; i<n; i++)
			D = lcm(D, d[i]);

		for(int i=0; i<n; i++)
			v[i] = D/d[i]*v[i];

		unsigned long long V = gcd(v[0], v[1]);
		for(int i=2; i<n; i++)
			V = gcd(V, v[i]);

		for(int i=0; i<n; i++)
			cout << v[i]/V << endl;
	}

	return 0;
}

C++: #include<cstdio>
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<cmath>

using namespace std;

#define reps(i,f,n) for(int i=f;i<int(n);i++)
#define rep(i,n) reps(i,0,n)

#ifdef __BORLANDC__
	typedef __int64 ll;
#else 
	typedef long long ll;
#endif


int n;
vector<int> d;
vector<int> s;
bool input(){
	cin>>n;
	if(n==0)return false;
	d=vector<int>(n);
	s=vector<int>(n);
	rep(i,n){
		cin>>d[i]>>s[i];
	}
	return true;
}

typedef pair<ll,ll> pll;


ll gcd(ll a, ll b){
	if(a<b)swap(a,b);
	
	while(1){
		while(b==0)printf("heee");
		ll c = a%b;
		
		if(c==0)return b;
		a = b;
		b = c;
	}
	return -1;
}
pll tubun(pll a){
	ll gc = gcd(a.first, a.second);
	a.first/=gc;
	a.second/=gc;
	return a;
}
ll lcm(ll a, ll b, ll c, ll d){
	pll tes1 = tubun(pll(a,b));
	pll tes2 = tubun(pll(c,d));
	
	a = tes1.first;  b = tes1.second;
	c = tes2.first;  d = tes2.second;
	
	
	ll bunbo = b*d;
	ll A = a*d;
	ll B = b*c;
	ll C = gcd(A,B);
	ll bunshi = A/C * B/C * C;
	
	return bunshi/bunbo;
}
vector<int> solve(){
	vector<int> ret;
	
	rep(i,n){
		pll hoge = tubun(pll(d[i],s[i]));
		d[i] = hoge.first;
		s[i] = hoge.second;
	}
	
	ll mygcd = gcd(s[0],s[1]);
	
	
	reps(i,2,n){
		mygcd = gcd(mygcd, s[i]);
	}
	rep(i,n)s[i]/=mygcd;
	
	ll mylcm = lcm(d[0],s[0],d[1],s[1]);
	reps(i,2,n){
		mylcm = lcm(mylcm, 1, d[i], s[i]);
	}
	
	rep(i,n){
		ret.push_back((int)(mylcm/d[i]*s[i]));
	}
	
	return ret;
}

void c_solve(){
	vector<int> ans = solve();
	rep(i,ans.size())cout<<ans[i]<<endl;
}

int main(){
	while(input())c_solve();	
}

C++: #include <iostream>
#include <vector>

using namespace std;

long int gcd(long int m,long int n){
    if ( ( 0 == m ) || ( 0 == n ) )
        return 0;
    while( m != n )
    {
        if ( m > n ) m = m - n;
        else         n = n - m;
    }
    return m;
}

long int lcm(long int m,long int n)
{
    if ( ( 0 == m ) || ( 0 == n ) )
        return 0;
    
    return ((m / gcd(m, n)) * n);
}

int main() {
    
    long int d,v,n;//,numerator[10];
    
    while (cin >> n) {
        if(n==0) break;
        vector<pair<long int,long int>> data;
        vector<pair<long int,long int>>::iterator it;
        for (int i=0; i<n; i++) {
            cin >> d >> v;
            pair<long int, long int> a(d,v);
            data.push_back(a);
        }
        
        long int v_1,result;
        it = data.begin();
        v_1 = it->second;
        it++;
        result = it->second;
        while(1){
            result = lcm(v_1, result);
            it++;
            if(it == data.end()) break;
            v_1 = it->second;
        }
        
        vector<long int> res;
        vector<long int>::iterator it_res;
        it = data.begin();
        while (it != data.end()) {
            v_1 = it->first * (result/it->second);
            res.push_back(v_1);
            it++;
        }
        it_res = res.begin();
        v_1 = *it_res;
        it_res++;
        result = *it_res;
        while(1){
            result = lcm(v_1, result);
            it_res++;
            if(it_res == res.end()) break;
            v_1 = *it_res;
        }
        
        it_res = res.begin();
        while (it_res != res.end()) {
            cout << result /(*it_res) << endl;
            it_res++;
        }
    }
}

C++: #include <cstdio>
#include <cmath>
#include <algorithm>
 
using namespace std;
 
#define MAX 10
typedef long long ll;
 
ll d[MAX],v[MAX];
 
ll gcd(ll a,ll b){
  return __gcd(a,b);
}
 
ll lcm(ll a,ll b){
  return a * b / gcd(a,b);
}
 
int main(){
  int n;
 
  while(scanf("%d" ,&n) ,n){
    for(int i = 0 ; i < n ; i++){
      scanf("%lld %lld" ,&d[i] ,&v[i]);
      ll a = gcd(d[i],v[i]);
      d[i] /= a;
      v[i] /= a;
    }       
     
    ll T = d[0],V = v[0];
    for(int i = 1 ; i < n ; i++){
      T = lcm(T,d[i]);
      V = gcd(V,v[i]);
    }
     
    for(int i = 0 ; i < n ; i++){
      ll div = T / d[i];
      printf("%lld\n" ,div*v[i]/V);
    }
  }
   
  return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second

template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pll> pip;
const ll INF = 1ll<<29;
const ll MOD = 1000000007;
const double EPS  = 1e-9;

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

ll gcd(ll *begin, ll *end) {
	ll res = *begin;
	while (begin != end) res = gcd(res, *begin), ++begin;
	return res;
}

ll lcm(ll *begin, ll *end) {
	ll res = *begin;
	while (begin != end) res = lcm(res, *begin), ++begin;
	return res;
}

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

int main() {
	while (cin >> n, n) {
		ll g, l, t;
		REP(i, n) {
			scanf("%lld %lld", d + i, v + i);
			g = gcd(d[i], v[i]);
			d[i] /= g; v[i] /= g;
		}
		
		l = lcm(d, d + n);
		g = gcd(v, v + n);
		
		REP(i, n) {
			ll ans = (l / d[i]) * (v[i] / g);
			cout << ans << endl;
		}
		
	}
	return 0;
}