#include <iostream>
#include <vector>
using namespace std;
typedef unsigned long long ull;

ull gcd(ull x, ull y)
{
  if (x < y) {
    swap(x, y);
  }
  ull r;
  while ((r = x % y) != 0) {
    x = y;
    y = r;
  }
  return y;
}

int main()
{
  int N;
  while (cin >> N && N != 0) {
    vector<pair<ull,ull> > v(N);
    for (int i = 0; i < N; i++) {
      ull d, w;
      cin >> d >> w;
      v[i] = make_pair(d, w);
    }

    ull g = v[0].first;
    ull l = v[0].first;
    for (int i = 1; i < N; i++) {
      g = gcd(g, v[i].first);
      l *= v[i].first;
    }
    l /= g;

    vector<ull> gs(N);
    gs[0] = v[0].second*(l/v[0].first);
    ull h = gs[0];
    for (int i = 1; i < N; i++) {
      gs[i] = v[i].second*(l/v[i].first);
      h = gcd(h, gs[i]);
    }
    for (int i = 0; i < N; i++) {
      cout << gs[i]/h << endl;
    }
  }
  return 0;
}