#include <iostream>
#include <cstdio>
#include <vector>
#include <iomanip>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <map>
#include <set>
#include <cmath>
using namespace std;

using VLL = vector <long long>;
using VPILL = vector < pair<long long, int> >;
int N;
VLL X;
VLL Y;
VLL P;
VLL ans;
VLL defaultMinDist;
VPILL PX;
VPILL PY;
int xcho;
int ycho;
long long defaultRes = 0;

const long long INF = 1000000000LL * 1000000000LL;
const long long IINF = 1000000000LL;

void solve(int now, int chosen) {
    if (now == N) {
        VLL minDist(defaultMinDist);

        long long res = defaultRes;
        long long lastX = -IINF;
        long long lastY = -IINF;
        long long resVal = 0;

        for (int i = 0; i < N; ++i) {
            // x axis
            if (xcho & (1 << PX[i].second)) {
                lastX = PX[i].first;
            }

            resVal = (PX[i].first-lastX) * P[PX[i].second];
            if (resVal < minDist[PX[i].second]) {
                res -= minDist[PX[i].second];
                res += resVal;
                minDist[PX[i].second] = resVal;
            }

            // y axis
            if (ycho & (1 << PY[i].second)) {
                lastY = PY[i].first;
            }

            resVal = (PY[i].first-lastY) * P[PY[i].second];
            if (resVal < minDist[PY[i].second]) {
                res -= minDist[PY[i].second];
                res += resVal;
                minDist[PY[i].second] = resVal;
            }
        }

        // backward
        lastX = IINF;
        lastY = IINF;

        for (int i = N-1; i >= 0; --i) {
            // x axis
            if (xcho & (1 << PX[i].second)) {
                lastX = PX[i].first;
            }

            resVal = (lastX-PX[i].first) * P[PX[i].second];
            if (resVal < minDist[PX[i].second]) {
                res -= minDist[PX[i].second];
                res += resVal;
                minDist[PX[i].second] = resVal;
            }

            // y axis
            if (ycho & (1 << PY[i].second)) {
                lastY = PY[i].first;
            }

            resVal = (lastY-PY[i].first) * P[PY[i].second];
            if (resVal < minDist[PY[i].second]) {
                res -= minDist[PY[i].second];
                res += resVal;
                minDist[PY[i].second] = resVal;
            }
        }

        ans[chosen] = min(ans[chosen], res);
        return ;
    }

    solve(now+1, chosen);

    xcho |= (1<<now);
    solve(now+1, chosen+1);
    xcho &= ~(1<<now);

    ycho |= (1<<now);
    solve(now+1, chosen+1);
    ycho &= ~(1<<now);
}

int main() {
    cin >> N;

    X = VLL(N);
    Y = VLL(N);
    P = VLL(N);
    defaultMinDist = VLL(N);

    PX = VPILL(N);
    PY = VPILL(N);

    for (int i = 0; i < N; ++i) {
        cin >> X[i] >> Y[i] >> P[i];
        PX[i] = make_pair(X[i], i);
        PY[i] = make_pair(Y[i], i);
        defaultMinDist[i] = P[i] * min(abs(X[i]), abs(Y[i]));
        defaultRes += defaultMinDist[i];
    }

    ans = VLL(N+1, INF);
    xcho = 0;
    ycho = 0;

    sort(PX.begin(), PX.end());
    sort(PY.begin(), PY.end());
    solve(0, 0);

    for (int k = 0; k <= N; ++k) {
        cout << ans[k] << endl;
    }

    return 0;
}

Measured memory_bytes: 3556