#include <iostream>
#include <utility>

using namespace std;

typedef unsigned long long BigInt;

BigInt gcd(BigInt a, BigInt b) {
  if (a < b) {
    swap(a, b);
  }
  while (b > 0) {
    a %= b;
    swap(a, b);
  }
  return a;
}

BigInt lcm(BigInt a, BigInt b) {
  return a * b / gcd(a, b);
}

int main() {
  int n;
  BigInt dh, vh;
  BigInt d[10], v[10];
  while (true) {
    cin >> n;
    if (n == 0) {
      return 0;
    }
    for (int i = 0; i < n; ++i) {
      cin >> d[i] >> v[i];
    }
    dh = d[0];
    vh = v[0];
    for (int i = 1; i < n; ++i) {
      BigInt y = lcm(v[i] * dh, vh * d[i]);
      BigInt kh = y / (v[i] * dh);
      BigInt z = gcd(dh * kh, vh);
      dh = dh * kh / z;
      vh /= z;
    }
    for (int i = 0; i < n; ++i) {
      cout << dh * v[i] / (d[i] * vh) << endl;
    }
  }
}