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++: #define _USE_MATH_DEFINES
#include <iostream>
#include <complex>
#include <algorithm>
#include <vector>
#include <stack>
#include <string>
#include <queue>
#include <cmath>
#include <math.h>
#include <numeric>
#include <list>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <climits>
#include <set>
#include <memory.h>
#include <memory>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cassert>
#include <map>
#include <cassert>
#include <time.h>
#include <ctime>

using namespace std;

typedef complex<double> xy_t;
typedef pair<xy_t, xy_t> line;
typedef long long ll;
typedef pair<int, int> P;
typedef pair<int , P> PP;
typedef pair<int, string> Ps;
typedef vector<int> vec;
typedef vector<vec> mat;
const int INF = 1 << 27;
const double EPS = 1e-10;
const double PI = 3.1415926535897932384626433832795;
const int CLK = CLOCKS_PER_SEC;

#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, m, n) for(int i = m; i < n; i++)
#define repD(i, n) for(int i = n; i >= 0; i--)

ll v[100];
ll d[100];
ll ratio[100];

ll gcd(ll u, ll v){
	while(u > 0){
		if(v > u) swap(u, v);
		u %= v;
	}
	return v;
}

ll lcm(ll u, ll v){
	return u / gcd(u, v) * v;
}

int main(){
	int n;
	while(cin >> n && n){
		ll tv = 1LL;
		rep(i, n){
			cin >> d[i] >> v[i];
			tv *= v[i];
		}
		rep(i, n) ratio[i] = d[i] * tv / v[i];
		ll c = ratio[0];
		ll m = 1LL;
		rep(i, n){
			c = gcd(c, ratio[i]);
		}
		rep(i, n) ratio[i] /= c;
		rep(i, n) m = lcm(m, ratio[i]);
		rep(i, n) cout << m / ratio[i] << endl;
	}	
	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
#define int unsigned long long
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define pb push_back
#define all(C) (C).begin(),(C).end()
const int MAX=10;
int n;
int d[MAX],v[MAX];

int gcd(int a,int b){
    return b?gcd(b,a%b):a;
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}

void solve(){
    rep(i,n){
        cin>>d[i]>>v[i];
        int g=gcd(d[i],v[i]);
        d[i]/=g;v[i]/=g;
    }
    int base=d[0];
    rep(i,n)base=lcm(base,d[i]);
    rep(i,n)v[i]*=(base/d[i]);
    base=v[0];
    rep(i,n)base=gcd(base,v[i]);
    rep(i,n)cout<<v[i]/base<<endl;
}
signed main(){
    cin.tie(0);ios_base::sync_with_stdio(0);
    while(cin>>n&&n)solve();
    return 0;
}

C++: #include <iostream>
using namespace std;

unsigned long long _gcd(unsigned long long m, unsigned long long n) {
    if (m == 0) return n;
    return _gcd(n % m, m);
}

unsigned long long gcd(unsigned long long m, unsigned long long n) {
    if (m < n) return _gcd(m, n);
    else return _gcd(n, m);
}

unsigned long long lcm(unsigned long long m, unsigned long long n) {
    if (m > n)
        return m * n / _gcd(n, m);
    return m * n / _gcd(m, n);
}


int main() {
    int n, i;

    while (cin >> n, n) {
        unsigned long long d[n], v[n];
        unsigned long long dm, vd;
        dm = 1;
        for (i = 0; i < n; i++) {
            cin >> d[i] >> v[i];
            dm = lcm(dm, d[i]);
        }
        for (i = 0; i < n; i++) {
            v[i] = v[i] * dm / d[i];
            // cout << "v/d: " << v[i] << "/" << dm << endl;
        }
        vd = v[0];
        for (i = 1; i < n; i++) {
            vd = gcd(vd, v[i]);
        }
        for (i = 0; i < n; i++) {
            cout << v[i] / vd << endl;
        }
    }
    return 0;
}

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

//#if __cplusplus >= 201103L
//#include <array>
//#include <tuple>
//#include <initializer_list>
//#include <forward_list>
//
//#define cauto const auto&
//#else

//#endif

using namespace std;


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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#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 DEBUG
#ifdef DEBUG
#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#else
#define dump(x) 
#define debug(x) 
#endif
#define LDcout(x,n) fixed<<setprecision(n)<<x

#define MOD 1000000007LL
#define EPS 1e-8
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL
#define maxs(x,y) x=max(x,y)
#define mins(x,y) x=min(x,y)

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) cin>>v[i].F>>v[i].S;
		ll t=1;
		rep(i,n){
			t=lcm(t,v[i].F);
		}
		vll w(n);
		rep(i,n){
			w[i]=t/v[i].F*v[i].S;
		}
		t=w[0];
		rep(i,n){
			t=__gcd(t,w[i]);
		}
		rep(i,n){
			cout<<w[i]/t<<endl;
		}
	}
}


signed main() {
	ios_base::sync_with_stdio(false);
    cin.tie(0);
  	cout<<fixed<<setprecision(20);
    mainmain();
}

C++: #include <iostream>
#define int unsigned long long
using namespace std;

int gcd(int a,int b){
	if(a < b) swap(a,b);
	while(b){
		a %= b;
		swap(a,b);
	}
	return a;
}

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

signed main(){
	int n;
	while(cin >> n,n){
		int d[10],v[10],lc = 1;
		for(int i = 0;i < n;i++) {
			cin >> d[i] >> v[i];
			lc = lcm(lc,v[i]);
		}
		for(int i = 0;i < n;i++){
			d[i] = lc / v[i] * d[i];
		}
		lc = 1;
		for(int i = 0;i < n;i++) lc = lcm(lc,d[i]);
		for(int i = 0;i < n;i++) cout << lc / d[i] << endl;
	}
	return 0;
}