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

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

int main()
{
	int n;
	while (cin >> n && n ){
		ll g, l;			// Ååöñ, Å¬ö{
		vector <P> d (n );
		rep (i, n ){
			cin >> d[i].first >> d[i].second;
		} // end rep
		rep (i, n ){
			g = __gcd(d[i].first, d[i].second );	
			d[i].first /= g;
			d[i].second /= g;
		} // end rep

		vector<P> pre;
		do{
			pre = d;
			g = d[0].first;
			for (int i = 1; i < n; i++ )
				g = __gcd (g, d[i].first );
			rep (i, n )
				d[i].first /= g;
		}while (pre != d );
		do{
			pre = d;
			g = d[0].second;
			for (int i = 1; i < n; i++ )
				g = __gcd (g, d[i].second );
			rep (i, n )
				d[i].second /= g;
		}while (pre != d );

		for (int i = 0; i < n; i++ ){
			if (d[i].second % d[i].first == 0 ){
				d[i].second /= d[i].first;
				continue;
			}else{
				ll nextm = d[i].first;
				for (int j = 0; j < n; j++ ){
					if (i != j )
						d[j].second *= nextm;
				} // end for
			} // end if
		} // end for
		do{
			pre = d;
			g = d[0].second;
			for (int i = 1; i < n; i++ )
				g = __gcd (g, d[i].second );
			rep (i, n )
				d[i].second /= g;
		}while (pre != d );

		rep (i, n ){
			cout << d[i].second << endl;
		} // end rep	

	} // end loop
		
	return 0;
}