#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;

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

ll gcd(ll a, ll b) {
  return b == 0 ? a : gcd(b, a % b);
}
ll lcm(ll a, ll b) {
  return a / gcd(a, b) * b;
}

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  while (cin >> n, n) {
    for (int i = 0; i < n; i++) {
      cin >> d[i] >> v[i];
      ll g = gcd(d[i], v[i]);
    }
    ll A = 1;
    for (int i = 0; i < n; i++) {
      A = lcm(A, d[i]);
    }
    ll B = A / d[0] * v[0];
    for (int i = 0; i < n; i++) {
      B = gcd(B, A / d[i] * v[i]);
    }
    for (int i = 0; i < n; i++) {
      cout << A / d[i] * v[i] / B << endl;
    }
  }

  return 0;
}
