#ifdef _MSC_VER
#include <__msvc_all_public_headers.hpp>
#undef min
#undef max
#else
#define NDEBUG
#include <bits/stdc++.h>
#endif

using namespace std;
using large = long long;

struct Ville {
    large x, y;
    large p;

    large near_x, near_y;
};

int nx;
int xs[20];
int ny;
int ys[20];

static large solve(Ville* const v, const int n, const int start, const int k) {
    if (k == 0) {
        auto sum = 0LL;
        for (int i = 0; i < n; ++i) {
            auto xmin = LLONG_MAX; // 南北の鉄道のいずれかからの最短距離
            auto ymin = LLONG_MAX; // 東西の鉄道のいずれかからの最短距離
            for (int ix = 0; ix < nx; ++ix)
                xmin = min(xmin, abs(v[i].x - xs[ix]));
            for (int iy = 0; iy < ny; ++iy)
                ymin = min(ymin, abs(v[i].y - ys[iy]));
            sum += v[i].p * min(xmin, ymin);
        }
        return sum;
    }

    auto score = LLONG_MAX;
    for (int i = start; i + k <= n; ++i) {
        // 南北の鉄道のx座標
        xs[nx++] = v[i].x;
        auto case1 = solve(v, n, i + 1, k - 1);
        nx--;
        // 東西の鉄道のy座標
        ys[ny++] = v[i].y;
        auto case2 = solve(v, n, i + 1, k - 1);
        ny--;

        score = min({score, case1, case2});
    }
    return score;
}

int main()
{
    int n;
    cin >> n;
    auto ville = vector<Ville>();
    for (auto i = 0; i < n; ++i) {
        auto v = Ville{};
        cin >> v.x >> v.y >> v.p;
        ville.push_back(v);
    }


    xs[nx++] = 0;
    ys[ny++] = 0;
    for (int k = 0; k < n; ++k) {
        cout << solve(ville.data(), n, 0, k) << "\n";
    }

    for (int k = n; k <= n; ++k) {
        cout << "0\n";
    }

    return 0;
}
