#include <iostream>
#include <cstring>
#include <algorithm>

using namespace std;

typedef long long ll;

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

int main()
{
    int n;

    while (cin >> n, n) {
        ll d[n], v[n], take[n];

        for (int i = 0; i < n; ++i) {
            cin >> d[i] >> v[i];
            take[i] = 3600 * d[i] / v[i];
        }

        ll time = take[0];
        for (int i = 1; i < n; ++i)
            time = lcm(time, take[i]);

        for (int i = 0; i < n; ++i)
            cout << v[i] * time / (d[i] * 3600) << endl;
    }

    return 0;
}