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 <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){
    scanf("%lld %lld" ,&d[0] ,&v[0]);
    
    ll V = v[0];
    for(int i = 1 ; i < n ; i++){
      scanf("%lld %lld" ,&d[i] ,&v[i]);

      for(int j = 2 ; j*j <= min(d[i],v[i]) ; j++){
	if(d[i] % j == 0 || v[i] % j == 0){
	  while(d[i] % j == 0 && v[i] % j == 0){
	    d[i] /= j;
	    v[i] /= j;
	  }
	}
      }
    }       
    
    ll T = d[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 <cstdio>
#include <iostream>
#include <set>
#include <utility>
using namespace std;

long gcd(long x, long y){
	if(x<y)	swap(x,y);
	
	if(y==0) return x;
	else return gcd(y, x%y);
}

long lcm(long x, long y){
	return x*y/gcd(x,y);	
}

int main(){
	while(1){
		int n;
		scanf(" %d", &n);
		if(n==0) break;
		
		long d[10000], v[10000];
		pair<long,long> p[10000];
		set<pair<long,long> > S;		

		for(int i=0; i<n; ++i){
			scanf(" %ld %ld", &p[i].first, &p[i].second);
			
			int div=gcd(p[i].first, p[i].second);
			p[i].first /= div;
			p[i].second /= div;
			S.insert(p[i]);
		}
		
		long T=p[0].first;
		for(int i=1; i<n; ++i){
			T = lcm(T, p[i].first);	
		}
		//printf("T= %ld\n", T);
		//printf("size= %ld\n", S.size());
		
		
		if(S.size()==1) for(int i=0; i<n; ++i) printf("1\n");
		else for(int i=0; i<n; ++i) printf("%ld\n", T/p[i].first*p[i].second);
	}
}

C++: #include<cstdio>
#include<algorithm>

using namespace std;

typedef	long long	ll;

ll gcd(ll a,ll b){
	for(;a;swap(a,b))	b%=a;
	return b;
}

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

int main(){
	for(int n;scanf("%d",&n),n;){
		int d[10],v[10];
		for(int i=0;i<n;i++)scanf("%d%d",d+i,v+i);

		ll deno=d[0];
		for(int i=1;i<n;i++)	deno=lcm(deno,d[i]);
		ll nume[10];
		for(int i=0;i<n;i++)	nume[i]=v[i]*deno/d[i];
		ll g=nume[0];
		for(int i=1;i<n;i++)	g=gcd(g,nume[i]);
		for(int i=0;i<n;i++)	printf("%d\n",nume[i]/g);
	}

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

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

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

C++: #define _USE_MATH_DEFINES
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<climits>
#include<string>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstring>
#include<stack>
#include<functional>
using namespace std;
const int INF = INT_MAX / 2;

typedef long long ll;

int N;
ll d[10], v[10];

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

int main(){
	while(cin >> N, N)
	{
		ll lcm1 = 1;
		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;
			lcm1 = LCM(lcm1, v[i]);
		}

		ll lcm2 = 1;
		for(int i = 0; i < N; i++)
		{
			lcm2 = LCM(lcm2, d[i] * (lcm1 / v[i]) );
		}
		
		for(int i = 0; i < N; i++)
		{
			printf("%lld\n", lcm2 / (lcm1 / v[i]) / d[i]);
		}
	}
	return 0;
}

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

#define lcm(a,b) (a / gcd(a,b) * b)

ll gcd(ll a,ll b){ return b ? gcd(b,a%b) : a; }
ll d[10],v[10],t[10];
int n;

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

C++: #include<iostream>
#include<algorithm>
#include<stdint.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define MAX 20
using namespace std;

int n;
uint64_t d[MAX],v[MAX];

int main()
{
 
  while(cin >> n,n)
    {
      uint64_t LCM,GCD;
      rep(i,n)
	{
	  cin >> d[i] >> v[i];
	  uint64_t div = __gcd(d[i],v[i]);
	  d[i] /= div, v[i] /= div;
	  GCD = (i==0?v[i]:__gcd(GCD,v[i]));
	  LCM = (i==0?d[i]:d[i]/__gcd(d[i],LCM)*LCM);
	}

      rep(i,n)cout << (uint64_t)((LCM/d[i])*(v[i]/GCD)) << endl;

    }
  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 unsigned long long ull;
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;

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

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

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

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

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

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