#include <iostream>
#include <vector>
#include <algorithm>
#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

typedef long long ll;

int n;

void make_irre (vector <ll> & a )
{
	ll g;			// Ååöñ
	vector <ll> pre;
	do{
		pre = a;
		g = a[0];
		for (int i = 1; i < n; i++ )
			g = __gcd (g, a[i] );
		rep (i, n )
			a[i] /= g;
	}while (pre != a );
}

int main()
{
	while (cin >> n && n ){
		vector <ll> d (n ), v(n );

		rep (i, n )
			cin >> d[i] >> v[i];

		// ùñªÌ
		rep (i, n ){
			ll g = __gcd(d[i], v[i] );	
			v[i] /= g;
			d[i] /= g;
		} // end rep
		// ¬x¯mÌùñ»(?)
		make_irre (v );

		// £¯mÌùñ»(?)
		make_irre (d );

		// ®ä»
		rep (i, n ){
			if (v[i] % d[i] == 0 ){
				v[i] /= d[i];
				continue;
			}else{
				ll m = d[i];
				rep (j, n )
					if (i != j )
						v[j] *= m;
			} // end if
		} // end rep
		make_irre (v );

		rep (i, n )
			cout << v[i] << endl;
	} // end loop
		
	return 0;
}