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

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

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

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

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