#include "bits/stdc++.h"
using namespace std;

#define int long long
#define DBG 1
#define dump(o) if(DBG){cerr<<#o<<" "<<(o)<<" ";}
#define dumpl(o) if(DBG){cerr<<#o<<" "<<(o)<<endl;}
#define dumpc(o) if(DBG){cerr<<#o; for(auto &e:(o))cerr<<" "<<e;cerr<<endl;}
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

//?????§??¬?´???°
int gcd(int x, int y) { return y ? gcd(y, x%y) : x; }
//?????§??¬?´???° ?????°???
int gcd(const vector<int> &v) {
	int ret = v[0];
	rep(i, 1, v.size())ret = gcd(ret, v[i]);
	return ret;
}
//????°???¬?????°
int lcm(int x, int y) { return x*y / gcd(x, y); }
//????°???¬?????° ?????°???
int lcm(const vector<int> &v) {
	int ret = v[0];
	rep(i, 1, v.size())ret = lcm(ret, v[i]);
	return ret;
}

signed main() {
	for (int n; cin >> n&&n;) {
		vector<int> d(n), v(n); rep(i, 0, n) { cin >> d[i] >> v[i]; }
		int vg = gcd(v);
		vector<int> l(n);
		rep(i, 0, n) {
			l[i] = lcm(d[i], v[i] / vg) / (v[i] / vg);
		}
		int ll = lcm(l);
		rep(i, 0, n) {
			cout << ll*(v[i] / vg) / d[i] << endl;
		}
	}
	return 0;
}