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

const int N = 10;

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]);
	
	while(s[0]==0 || s[1]==0)printf("heeee");
	reps(i,2,n)mygcd = gcd(mygcd, s[2]);
	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>

typedef long long ll;

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

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

int main(){
	int n;
	while (std::cin >> n, n){
		ll d[11], v[11], mul = 1;
		for (int i = 0; i < n; ++i){
			std::cin >> d[i] >> v[i];
			ll g = gcd(d[i], v[i]);
			d[i] /= g, v[i] /= g;
			mul = lcm(mul, v[i]);
		}
		for (int i = 0; i < n; ++i)d[i] *= (mul / v[i]);
		ll ans = lcm(d[0], d[1]);
		for (int i = 2; i < n; ++i)ans = lcm(ans, d[i]);
		for (int i = 0; i < n; ++i)std::cout << ans / d[i] << std::endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
long long gcd(long long a,long long b){
  return b?gcd(b,a%b):a;
}

int main(){
  int n;
  while(1){
    cin >> n;
    if(n==0) break;
    long long d[10],v[10];
    for(int i=0;i<n;i++){
      cin >> d[i] >> v[i];
   }
    long long d_all=d[0],v_all=v[0];
    for(int i=1;i<n;i++){
      d_all = ( d[i]*v_all / gcd(d_all*v[i], d[i]*v_all) ) * d_all;
    }
    for(int i=0;i<n;i++){
      cout << d_all * v[i] / v_all / d[i] << "\n";
   }
  }
}

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

using namespace std;

typedef long long lint;

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

lint lcm(lint a, lint b)
{
	if (a < b) swap(a, b);
	return (a / gcd(a, b) * b);
}

int main()
{
	int n;
	lint v[16], d[16], a[16];
	
	while (scanf("%d", &n) && n){
		lint dl = 1;
		lint common;
		for (int i = 0; i < n; i++){
			scanf("%lld %lld", d + i, v + i);
			common = gcd(d[i], v[i]);
			d[i] /= common; v[i] /= common;
			dl = lcm(dl, d[i]);
		}
		
		common = dl / d[0] * v[0];
		for (int i = 0; i < n; i++){
			a[i] = dl / d[i] * v[i];
			common = gcd(common, a[i]);
		}
		
		for (int i = 0; i < n; i++){
			printf("%lld\n", a[i] / common);
		}
	}
	
	return (0);
}

C++: #include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<cstdio>
#include<climits>
#include<cmath>
#include<cstring>
#include<string>

#define f first
#define s second
#define mp make_pair

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define FOR(i,c) for(__typeof((c).begin()) i=(c).begin(); i!=(c).end(); i++)
#define ALL(c) (c).begin(), (c).end()

using namespace std;

typedef unsigned int uint;
typedef long long ll;

template<class T>
T gcd(T a, T b){
  if(a > b) swap(a,b);
  if(a == 0) return b;
  return gcd(a, b%a);
}

ll meet(int ad, int av, int bd, int bv){
  ll aa = (ll)ad * bv;
  ll bb = (ll)bd * av;
  return (aa * bb / gcd(aa, bb)) / aa;
}

int main(){
  int n;
  while(scanf("%d",&n), n){
    int d[n],v[n];
    ll ans = 1;
    scanf("%d%d",&d[0],&v[0]);
    REP(i, n-1){
      int bd, bv;
      ll tmp;
      scanf("%d%d",&d[i+1],&v[i+1]);
      tmp = meet(d[0], v[0], d[i+1], v[i+1]);
      ans = (ans * tmp) / gcd(ans, tmp);
    }
    //printf("ans = %d\n",ans);
    REP(i,n)
      printf("%d\n",(int)(ans*d[0]*v[i]/d[i]/v[0]));
  }
  return 0;
}

C++: #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <complex>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <functional>
#include <iostream>
#include <map>
#include <set>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define SORT(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define EQ(a,b) (abs((a)-(b))<eps)
ll d[20],v[20];
ll ans[20];
void add(int k,ll x,ll y)
{
	if(k==1)
	{
		ans[k-1]=x;
		ans[k]=y;
		return;
	}
	ll g=__gcd(ans[k-1],x);
	//cout << "g :"<<  g << endl;
	ans[k]=y*(ans[k-1]/g);
	for(int i=0;i<k;i++)ans[i]*=(x/g);
}
int main()
{
	while(1)
	{
		int n;
		cin >> n;
		if(n==0)break;
		for(int i=0;i<n;i++)
		{
			cin >> d[i] >> v[i];
			ll g=__gcd(d[i],v[i]);
			d[i]/=g;
			v[i]/=g;
		}
		for(int i=1;i<n;i++)
		{
			ll A,B;
			A=d[i]*v[i-1];
			B=d[i-1]*v[i];
			ll G=__gcd(A,B);
			A/=G;
			B/=G;
			//cout << A << ' ' << B << endl;
			add(i,A,B);
		}
		for(int i=0;i<n;i++)printf("%lld\n",ans[i]);
		//for(int i=0;i<n;i++)printf("%lld\n",ans[i]/v[i]*d[i]);
	}
	return 0;
}