#include <iostream>
using namespace std;
long long int n,L,d[10],v[10],G,f[10],G1,L1;

long long int gcd(long long int x,long long int y) {
  if(y==0) return x;
  return gcd(y ,x%y);
}

long long int lcm(long long int x,long long int y) {
  return x * y / gcd(x,y);
}

int main() {
  while(cin >> n) {
    if(n==0) break;
    for(int i=0;i<n;i++) {
      cin >> d[i] >> v[i];
      long long int a = gcd(d[i],v[i]); //yakubun
      d[i] /= a;
      v[i] /= a;
    }

    G = gcd(d[0],d[1]);
    L = lcm(d[0],d[1]);
    for(int i=2;i<n;i++) {
      G = gcd(G,d[i]);
      L = lcm(L,d[i]);
    }
    G1 = gcd(v[0],v[1]);
    L1 = lcm(v[0],v[1]);
    for(int i=2;i<n;i++) {
      G1 = gcd(G,v[i]);
      L1 = lcm(L,v[i]);
    }
    /*
    for(int i=0;i<n;i++) {
      d[i] /= G;
    }
*/
    for(int i=0;i<n;i++) {
      f[i] = L * v[i] / (d[i] * G1);
      cout << f[i] << endl;
    }
  }
}