#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <cmath>
#include <queue>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
const int INF = 1<<30;

typedef long long Int;

Int gcd(Int a, Int b) {
  return b==0 ? a : gcd(b, a%b);
}
Int lcm(Int a, Int b) {
  // printf("%lld,%lld  %lld\n",a,b,gcd(a,b));
  return a / gcd(a,b) * b;
}
Int gcd(vector<Int> v) {
  Int res = 0;
  REP(i,v.size()) {
    if (!i) res = v[0];
    else res = gcd(res,v[i]);
  }
  return res;
}
Int lcm(vector<Int> v) {
  Int res = 1;
  FOR(it,v)
    res = lcm(res, *it);
  return res;
}

int main() {
  int n;
  while(cin >> n, n) {
    vector<Int> d(n), v(n);
    REP(i,n)
      cin >> d[i] >> v[i];
    Int l = lcm(d);
    // cout << " "<<l << endl;
    vector<Int> ans;
    REP(i,n)
      ans.push_back(l / d[i] * v[i]);
    Int g = gcd(ans);
    REP(i,n)
      cout << ans[i] / g << endl;
  }
}