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

void mainmain(){
	int n;
	while(cin>>n,n){
		vector<pll> v(n);
		rep(i,n) cin>>v[i].F>>v[i].S;
		ll g=v[0].S;
		rep(i,n-1){
			g=g*v[i+1].S/__gcd(g,v[i+1].S);
		}
		// cout<<"g "<<g<<endl;
		rep(i,n){
			ll t=g/v[i].S;
			v[i].F*=t;
		}
		ll e=v[0].F;
		rep(i,n-1){
			e=__gcd(e,v[i+1].F);
		}
		rep(i,n){
			v[i].F/=e;
		}
		ll f=v[0].F;
		rep(i,n-1){
			f=f/__gcd(f,v[i+1].F)*v[i+1].F;
		}
		// cout<<"f "<<f<<endl;
		vll ans(n);
		rep(i,n){
			ans[i]=f/v[i].F;
			// cout<<f/v[i].F<<endl;
		}
		ll d=ans[0];
		rep(i,n-1){
			d=__gcd(d,ans[i+1]);
		}
		rep(i,n){
			cout<<ans[i]/d<<endl;
		}
	}
}



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

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

long long gozyo(long long a,long long b){
  if(a<b){
    long long temp=a;
    a=b;
    b=temp;
  }
  while(a%b!=0){
    long long  temp=a%b;
    a=b;
    b=temp;
  }
  return b;
}

main(){
  int n;
  long long d[11];
  long long v[11];
  long long a[11];
  long long k1,k2,k3;
  long long t1,t2,t3;
  while( (cin >> n),n ){
    for(int i=0;i<n;i++){
      cin >> d[i] >> v[i];
    }



    k1=v[0];
    t1=v[0];
    for(int i=1;i<n;i++){
      k1 = gozyo(t1,v[i]);
      t1 = t1/k1*v[i];
    }

    a[0]=t1/v[0]*d[0];
    k3=a[0];
    t3=a[0];
    for(int i=1;i<n;i++){
      a[i]=t1/v[i]*d[i];
      k3 = gozyo(t3,a[i]);
      t3 = t3/k3*a[i];
    }


    for(int i=0;i<n;i++){
      cout << t3/a[i] << endl;
    }
    

  }
}