#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;
typedef long long ll;

ll gcd(ll a,ll b)
{
	if(b == 0) return a;
	else return gcd(b,a%b);
}

ll lcm(ll a,ll b)
{
	if(a == 0 || b == 0) return 0;
	return ((a / gcd(a,b)*b));
}

int main()
{
	int n;
	while(cin >> n && n)
	{
		vector<pair<ll,ll> > v;
		
		rep(i,n)
		{
			ll a,b;
			cin >> a >> b;
			v.push_back(make_pair(a,b));
		}

		rep(i,n)
		{
			ll temp = gcd(v[i].first,v[i].second);
			v[i].first /= temp;
			v[i].second /= temp;
		}

		ll t,t2;
		rep(i,n)
		{
			if(i == 0)
			{
				t = v[i].first;
				t2 = v[i].second;
			}
			else
			{
				t = lcm(t,v[i].first);
				t2 = gcd(t2,v[i].second);
			}
		}

		rep(i,n)
		{
			ll ans = t * v[i].second;
			ans /= t2;
			ans /= v[i].first;
			cout << ans << endl;
		}
	}
	return 0;
}