#include <vector>
#include <list>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>

#define FOR(i,b,n) for(int i=b;i<n;i++)
#define RFOR(i,b,n) for(int i=n-1;i>=b;i--)
#define CLR(mat) memset(mat, 0, sizeof(mat))
#define NCLR(mat) memset(mat, -1, sizeof(mat))

using namespace std;

typedef pair<int,int> paii;
typedef long long ll;

int n;
ll dist[100000], vero[100000];

ll gcd(ll a, ll b)
{
	return ( b > 0 )? gcd(b, a%b) : a ;
}

ll lcm(ll a, ll b)
{
	return ( a / gcd(a, b) * b);
}

void solve()
{	
	//dist[]/vero[]

	FOR(i, 0, n)//約分
	{
		ll cd = gcd(dist[i], vero[i]);
		dist[i] /= cd;
		vero[i] /= cd;
	}
	
	ll bs = dist[0];
	
	FOR(i, 0, n)//通分・分母
	{
		bs = lcm(bs, dist[i]);
	}
	
	FOR(i, 0, n)//通分・分子
	{
		vero[i] = vero[i] * (bs / dist[i]);
	}
	
	ll cm = vero[0];
	
	FOR(i, 0, n)//分子の最大公約数
	{
		cm = gcd(cm, vero[i]);
	}
	
	FOR(i, 0, n)
	{
		cout << vero[i]/cm << endl;
	}
	
	return;
}

int main()
{
	
	while(cin >> n, n)
	{
		FOR(i, 0, n)
		{
			cin >> dist[i] >> vero[i];
		}
		
		solve();
	}
	
	return 0;
}