#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define REP(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(a) (a).begin(),(a).end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> P;
const int INF=1e9;
ll gcd(ll a,ll b){
      if(b==0)return a;
      return gcd(b,a%b);
}
ll lcm(ll a,ll b){
      return a/gcd(a,b)*b;
}
int main(){
      ll n,d[10],v[10];
      while(cin>>n&&n){
            REP(i,n){
                  cin>>d[i]>>v[i];
                  ll a=gcd(d[i],v[i]);
                  v[i]/=a;d[i]/=a;
            }
            ll c=1;
            REP(i,n)c=lcm(c,d[i]);
            REP(i,n)v[i]*=(c/d[i]);
            ll ans=v[0];
            REP(i,n)ans=gcd(ans,v[i]);
            REP(i,n)cout<<v[i]/ans<<endl;
      }
}