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++: #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 <bits/stdc++.h>
using namespace std;

using ll = long long;

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

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

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

C++: #include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
//#include <utility>
#include <set>
#include <iostream>
//#include <memory>
#include <string>
#include <vector>
#include <algorithm>
//#include <functional>
#include <sstream>
//#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
//#include <cctype>
#include <cstring>
//#include <ctime>
#include <iterator>
#include <bitset>
//#include <numeric>
//#include <list>
//#include <iomanip>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#else

#endif

using namespace std;


namespace{
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}


#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8
static const int INF=1<<24;
ll __lcm(ll a,ll b){
	return a/__gcd(a,b)*b;
}
void mainmain(){
	int n;
	while(cin>>n,n){
		vector<pll> v(n);
		rep(i,n) scanf("%lld %lld",&v[i].F,&v[i].S);
		ll g=v[0].F;
		reep(i,1,n){
			g=__lcm(v[i].F,g);
			// g=v[i+1].S/__gcd(g,v[i+1].S)*g;
		}
		// cout<<"g "<<g<<endl;
		rep(i,n){
			// ll t=g/v[i].S;
			v[i].S=g*v[i].S/v[i].F;
		}
		ll e=v[0].S;
		reep(i,1,n){
			e=__gcd(e,v[i].S);
		}
		rep(i,n){
			printf("%lld\n",v[i].S/e);
		}
		continue;
	}
}



}
main() try{
    mainmain();
}
catch(...){
}

C++: #define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;

ll gcd(ll a, ll b){
    return a ? gcd(b%a, a) : b;
}

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

int main(int argc, char ** argv) {
    int n;
    while (cin >> n && n){
        ll d[20], v[20];
        ll l1 = 1;
        for (int i = 0; i < n; ++i) {
            cin >> d[i] >> v[i];
            l1 = lcm(l1, v[i]);
        }
        ll l2 = 1;
        for (int i = 0; i < n; ++i) {
            l2 = lcm(l2, d[i] * l1 / v[i]);
        }
        for (int i = 0; i < n; ++i) {
            cout << l2 / (l1*d[i] / v[i]) << endl;
        }
    }
}

C++: #include <bits/stdc++.h>
using namespace std;
using ll = long long;

ll GCD(ll a, ll b) {
	return b ? GCD(b, a % b) : a;
}

ll LCM(ll a, ll b) {
	return a / GCD(a, b) * b;
}

int main()
{
	ll n;
	while (cin >> n, n) {
		vector<ll> d(n), v(n);
		for (int i = 0; i < n; i++) {
			cin >> d[i] >> v[i];
			ll gcd = GCD(d[i], v[i]);
			d[i] /= gcd;
			v[i] /= gcd;
		}
		vector<ll> res(n);
		ll lcm = d[0], gcd = v[0];
		for (int i = 1; i < n; i++) {
			lcm = LCM(lcm, d[i]);
			gcd = GCD(gcd, v[i]);
		}
		for (int i = 0; i < n; i++) {
			cout << lcm * v[i] / d[i] / gcd << endl;
		}
	}
	return 0;
}