#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
using namespace std;

typedef istringstream ISS;
typedef ostringstream OSS;
typedef vector<string> VS;
typedef int INT;
typedef vector<INT> VI;
typedef vector<VI> VVI;
typedef pair <INT, INT> II;
typedef vector <II> VII;

template<class T> ostream& operator << ( ostream& os, vector<T> v ) {
    for ( typename vector<T>::iterator it_i = v.begin(); it_i != v.end(); ++it_i ) {
        os << *it_i << ", ";
    }
    return os;
}
template<class T> T gcd( T a, T b ) {
    return !b ? a : gcd( b, a % b );
}
template<class T> T lcm( T a, T b ) {
    return a / gcd( a, b ) * b;
}


typedef long long LL;
const int SIZE = 11;
int n;
LL D[SIZE], V[SIZE];
LL T[SIZE];

void solve() {
    for ( int i = 0; i < n; ++ i ) {
        LL t = gcd( D[i], V[i] );
        D[i] /= t;
        V[i] /= t;
    }
    LL vgcd = V[0];
    for ( int i = 1; i < n; ++ i ) {
        vgcd = gcd( vgcd, V[i] );
    }
    LL dlcm = D[0];
    for ( int i = 1; i < n; ++ i ) {
        dlcm = lcm( dlcm, D[i] );
    }
    for ( int i = 0; i < n; ++ i ) {
        cout << ( dlcm * V[i] / D[i] / vgcd ) << endl;
    }
    return;
}

int main() {
    while ( cin >> n && n ) {
        for ( int i = 0; i < n; ++ i ) {
            cin >> D[i] >> V[i];
        }
        solve();
    }
    return 0;
}