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 <iostream>
#include <vector>
#include <utility>

using namespace std;

long long int gcd(long long int, long long int);
//long long int lcm(long long int, long long int);

int main(){
	int n;
	while (cin >> n, n) {
		vector<int> d(n), v(n);
		for (int i = 0; i < n; i++) {
			cin >> d[i] >> v[i];
		}
		pair<long long int, long long int> cur = make_pair(d[0], v[0]);
		for (int i = 1; i < n; i++) {
			long long int A = cur.first * v[i],
						  B = cur.second * d[i];
			if (A == B) {continue;} 
			else if (cur.second > v[i]) {cur.first = (A / gcd(A, B)) * d[i]; cur.second = v[i];}
			else {cur.first = (B / gcd(A, B)) * d[i];}
		}
		for (int i = 0; i < n; i++) {
			cout << (cur.first * v[i]) / (cur.second * d[i]) << endl;	
		}
	}
	return 0;
}

long long int gcd(long long int a, long long int b){
	while (a != b) {
		if (a > b) {
			a = a - b;	
		} else {
			b = b - a;	
		}	
	}
	return a;
	/*
	if (a == b) return a;
	else {
		if (a > b) {
			return gcd(a - b, b);	
		} else {
			return gcd(b - a, a);	
		}	
	}
	*/
}

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

pair<long long int, long long int> func(pair<long long int, long long int> a, pair<long long int, long long int> b){
	long long int A = a.first * b.second, 
		   B = a.second * b.first;
	if (A == B) {
		if (a.second > b.second) {return make_pair(b.first, b.second);}
		else {return make_pair(a.first, a.second);}
	} else {
		if (a.second > b.second){
			return make_pair((A / gcd(A, B)) * b.first, b.second);	
		} else {
			return make_pair((B / gcd(A, B)) * a.first, a.second);	
		}
	}
}

C++: #include<iostream>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
ll lcm(ll a,ll b){return a/__gcd(a,b)*b;}
int main(){
	int n,d[10],v[10],t;
	while(cin>>n,n){
		rep(i,n)cin>>d[i]>>v[i],t=__gcd(d[i],v[i]),d[i]/=t,v[i]/=t;
		ll a=d[0],b=v[0];
		rep(i,n)a=lcm(a,d[i]),b=__gcd(b,(ll)v[i]);
		rep(i,n)cout<<a/b*v[i]/d[i]<<endl;
	}
	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;

ll w(ll arr[10]){
	ll ans = arr[0];
	for(int i = 1 ; i < n ; i++)
		ans = gcd(ans,arr[i]);
	return ans;
}
int main(){
	while(cin >> n , n){
		ll g = 1;
		for(int i = 0 ; i < n ; i++)
			cin >> d[i] >> v[i] ;
		ll p = w(d);
		ll q = w(v);
		for(int i = 0 ; i < n ; i++){
			d[i] /= p;
			v[i] /= q;
		}
		for(int i = 0 ; i < n ; i++){
			long long a = v[i];
			for(int j = 0 ; j < n ; j++){
				if(i==j) continue;
				a *= d[j];
			}
			t[i] = a;
		}
		ll r = w(t);
		for(int i = 0 ; i < n ; i++)
			cout << t[i]/r << endl;
	}
}

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]=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>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>

using namespace std;

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

template<class T> void debug(T begin, T end){ for(T i = begin; i != end; ++i) cerr<<*i<<" "; cerr<<endl; }
inline bool valid(int x, int y, int W, int H){ return (x >= 0 && y >= 0 && x < W && y < H); }

typedef long long ll;
const int INF = 100000000;
const double EPS = 1e-8;
const int MOD = 1000000007;
int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
ll gcd(ll x, ll y){
  if(x % y == 0) return y;
  else return gcd(y, x % y);
}
ll lcm(ll x, ll y){
  return x * y / gcd(x, y);
}
int main(){
  int N;
  while(cin >> N && N){
    ll d[10], v[10];
    REP(i, N) cin >> d[i] >> v[i];
    REP(i, N){
      ll g = gcd(d[i], v[i]);
      d[i] /= g;
      v[i] /= g;
    }
    ll D = d[0], V = v[0];
    REP(i, N){
      D = lcm(D, d[i]);
      V = gcd(V, v[i]);
    }
    REP(i, N){
      cout<< D / d[i] * v[i] / V << endl;
    }
  }
  return 0;
}