#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef unsigned long long int lli;
struct student{
  int d, v;
};
vector<student> vs;

lli __gcd(lli a, lli b){
  if(b == 0)return a;
  return __gcd(b, a%b);
}
lli __lcm(lli a, lli b){
  return a/__gcd(a, b)*b;
}
int main(int argc, char *argv[]){
  int n;
  while(std::cin >> n, n){
    vs.clear();
    for (int i = 0; i < n; i++) {
      student s;
      std::cin >> s.d >> s.v;
      vs.push_back(s);
    }
    lli lcm = 1;
    for (int i = 0; i < n; i++) {
      lcm = __lcm(lcm, vs[i].v);
    }
    vector<lli> ans(n);
    for (int i = 0; i < n; i++) {
      ans[i] = lcm/vs[i].v*vs[i].d;
    }
    lli gcd = ans[0];
    for (int i = 0; i < n; i++) {
      gcd = __gcd(gcd, ans[i]);
    }
    for (int i = 0; i < n; i++) {
      ans[i] /= gcd;
    }
    lcm = 1;
    for (int i = 0; i < n; i++) {
      lcm = __lcm(lcm, ans[i]);
    }
    for (int i = 0; i < n; i++) {
      std::cout << lcm/ans[i] << std::endl;
    }
  }
  return 0;
}