#include <iostream>
#include <algorithm>

using namespace std;

typedef long long int lli;

lli gcd(lli a, lli b)
{
  return (b)? gcd(b, a%b): a;
}

lli lcm(lli a, lli b)
{
  if(b > a) swap(a, b);
  return a/gcd(a, b)*b;
}

int main()
{
  lli t, n, d[10001], v[10001];
  while(cin>>n && n){
    for(int i = 0; i < n; ++i){
      cin >> d[i] >> v[i];
      t = gcd(d[i], v[i]);
      d[i] /= t;
      v[i] /= t;
    }

    t = lcm(d[0], d[1]);
    for(int i = 2; i < n; ++i)
      t = lcm(t, d[i]);

    for(int i = 0; i < n; ++i)
      v[i] *= (t/d[i]);

    t = gcd(v[0], v[1]);
    for(int i = 2; i < n; ++i)
      t = gcd(t, v[i]);

    for(int i = 0; i < n; ++i)
      cout << v[i]/t << endl;
  }

  return 0;
}