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 <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll inf =1LL << 62;

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(void){
	int n;
	ll runner[10][2];
	ll change[10];
	while(cin >> n,n){
		rep(i,n) cin >> runner[i][0] >> runner[i][1];
		ll l=runner[0][1];
		rep(i,n-1) l=lcm(l,runner[i+1][1]);
		rep(i,n) change[i]=runner[i][0]*l/runner[i][1];
		l=change[0];
		rep(i,n-1) l=lcm(l,change[i+1]);
		rep(i,n) cout << l/change[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>
#include<sstream>
using namespace std;
typedef long long ll;

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(){
	ll N;
	while(cin >> N, N)
	{
		ll d[10], v[10], gcdV = 0, lcmD = 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;
			lcmD = LCM(lcmD, d[i]);
			gcdV = GCD(gcdV, v[i]);
		}
		for(int i = 0; i < N; i++)
		{
			printf("\t%lld\n", v[i] / gcdV * (lcmD / d[i]));
	}
	}
}

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

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
template<class T> inline T sqr(T x) {return x*x;}

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef long long ll;

#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define each(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define exist(s,e) ((s).find(e)!=(s).end())
#define range(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  range(i,0,n)
#define clr(a,b) memset((a), (b) ,sizeof(a))
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

const double eps = 1e-10;
const double pi  = acos(-1.0);
const ll inf =1LL << 62;

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(void){
	int n;
	ll runner[10][2];
	ll change[10];
	while(cin >> n,n){
		rep(i,n) cin >> runner[i][0] >> runner[i][1];
		rep(i,n) {
			ll tmp=gcd(runnner[i][0],runnner[i][1]);
			runnner[i][0]/=tmp;
			runnner[i][1]/=tmp;
		}
		ll l=runner[0][1];
		rep(i,n-1) l=lcm(l,runner[i+1][1]);
		rep(i,n) change[i]=l/runner[i][1]*runner[i][0];
		l=change[0];
		rep(i,n-1) l=lcm(l,change[i+1]);
		rep(i,n) cout << l/change[i] << endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int n; long long p[10], q[10];
long long gcd(long long x, long long y) {
	return y ? gcd(y, x % y) : x;
}
int main() {
	while(cin >> n, n) {
		for(int i = 0; i < n; i++) {
			cin >> p[i] >> q[i];
			int r = gcd(p[i], q[i]); p[i] /= r, q[i] /= r;
		}
		long long s = 1;
		for(int i = 0; i < n; i++) s = s / gcd(s, q[i]) * q[i];
		for(int i = 0; i < n; i++) p[i] *= s / q[i]; s = 1;
		for(int i = 0; i < n; i++) s = s / gcd(s, p[i]) * p[i];
		for(int i = 0; i < n; i++) cout << s / p[i] << endl;
	}
}

C++: #include<bits/stdc++.h>

using namespace std;

int N;
int Distance[10], Speed[10];
unsigned long long Lcm[10][10];


unsigned long long findLcm(unsigned long long nowA, unsigned long long nowB) {
	unsigned long long a, b;

	a = nowA;
	b = nowB;
	while (b ^= a ^= b ^= (a %= b));
	
	return (nowA / a) * nowB;
}

void solve() {
	int k;
	unsigned long long nowLcm;

	for (int i = 0; i < N; ++i) {
		k = 0;
		for (int j = 0; j < N; ++j) {
			if (i == j) {
				continue;
			}
			nowLcm = findLcm(Distance[i] * Speed[j], Distance[j] * Speed[i]);
			Lcm[i][k++] = nowLcm / (Distance[i] * Speed[j]);
		}
	}

	for (int i = 0; i < N; ++i) {
		for (int j = 1; j < N - 1; ++j) {
			Lcm[i][0] = findLcm(Lcm[i][0], Lcm[i][j]);
		}
	}

	for (int i = 0; i < N; ++i) {
		cout << Lcm[i][0] << endl;
	}
}

int main() {

	while (cin >> N, N) {
		memset(Distance, 0, sizeof(Distance));
		memset(Speed, 0, sizeof(Speed));
		memset(Lcm, 0, sizeof(Lcm));
		for (int i = 0; i < N; ++i) {
			cin >> Distance[i] >> Speed[i];
		}
		////show:
		//for (int i = 0; i < N; ++i) {
		//	cout << Distance[i] << " " << Speed[i] << endl;
		//}
		solve();
	}

	return 0;
}