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

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

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