#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<cassert>
#include<iostream>
#include<sstream>
#include<string>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<utility>
#include<numeric>
#include<algorithm>
#include<bitset>
#include<complex>
#include<stack>

using namespace std;

typedef long long Int;
typedef vector<int> vint;
typedef vector<Int> vInt;
typedef pair<int,int> pint;
typedef pair<Int,Int> pInt;
typedef vector<string> vstring;
typedef vector<pint> vpint;
typedef vector<pInt> vpInt;
typedef stringstream SS;

template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }

#define rep(i,n) for(int i=0;i<(n);++i)
#define repn(i,m,n) for(int i=(m);i<(n);++i)
#define repd(i,n) for(int i=(n)-1;i>=0;--i)
#define repnd(i,m,n) for(int i=(n)-1;i>=(m);--i)
#define rep0(i,n) for(i=0;i<(n);++i)
#define repn0(i,m,n) for(i=(m);i<(n);++i)
#define repd0(i,n) for(i=(n)-1;i>=0;--i)
#define repnd0(i,m,n) for(i=(n)-1;i>=(m);--i)
#define repc(i,n) for(int i=0;i<=(n);++i)
#define repcn(i,m,n) for(int i=(m);i<=(n);++i)
#define repcd(i,n) for(int i=(n);i>=0;--i)
#define repcnd(i,m,n) for(int i=(n);i>=(m);--i)
#define repc0(i,n) for(i=0;i<=(n);++i)
#define repcn0(i,m,n) for(i=(m);i<=(n);++i)
#define repcd0(i,n) for(i=(n);i>=0;--i)
#define repcnd0(i,m,n) for(i=(n);i>=(m);--i)
#define all(n) n.begin(),n.end()
#define sz(n) ((int)(n).size())
#define IL for(;;)
#define MP make_pair
#define PB push_back
#define X second
#define Y first
#define p_queue(n) priority_queue<n,vector<n>,greater<n> >
#define PUTLINE cout<<"LINE:"<<__LINE__<<endl;

const int INF = 2147483647/3;
const double EPS = 1e-10;
const double PI = acos(-1.0);

const int dx[]={1,-1,0,0,1,1,-1,-1,0};
const int dy[]={0,0,1,-1,1,-1,1,-1,0};

vpInt d;

Int gcd(Int a, Int b) {
	return (b == 0) ? a : gcd(b, a % b);
}

pInt gcd(pInt a, pInt b) {
//cout << a.first << " " << a.second << " " << b.first << " " << b.second << endl;
	if (b.first == 0) return a;
	Int n = (a.first * b.second) / (b.first * a.second);
//cout << (a.first * b.second) << " " << (b.first * a.second) << " " << n << endl;
	pInt p;
	p.first = a.first * b.second - b.first * a.second * n;
	p.second = a.second * b.second;
	Int g = gcd(p.first, p.second);
	p.first /= g;
	p.second /= g;
	return gcd(b, p);
}

int main() {
	int n;
	IL {
		cin >> n;
		if (n == 0) break;
		d.clear();
		rep (i, n) {
			int dd, vv;
			cin >> dd >> vv;
			d.PB(MP(dd, vv));
		}
		pInt g, l = d[0];
		repn (i, 1, n) {
			g = gcd(l, d[i]);
			l.first = l.first * d[i].first * g.second;
			l.second = l.second * d[i].second * g.first;
			Int gg = gcd(l.first, l.second);
			l.first /= gg;
			l.second /= gg;
		}
		rep (i, n) {
			cout << l.first * d[i].second / d[i].first / l.second << endl;
		}
	}
	return 0;
}