#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cassert>

using namespace std;

#define print(x) cout << x << endl
#define input(x) cin >> x

typedef long long llint;

const llint INFLL = 0x3f3f3f3f3f3f3f3fLL;
const int INF = 0x3f3f3f3f;
const int N = 18;

struct Point {
    int x, y, p;
};

llint dp1[N][N];
llint dp2[N][N];

llint calc(const vector<Point>& ps, const vector<int>& disx, int l, int r) {
    if (l == r) {
        return 0;
    }
    int n = ps.size();
    if (dp2[l][r] < INFLL) {
        return dp2[l][r];
    }
    llint tot = 0;
    for (int i = l + 1; i <= r; i++) {
        if (i <= 0 || i > n) {
            continue;
        }
        int ll = l > 0?  ps[l - 1].y: -INF;
        int rr = r <= n? ps[r - 1].y: INF;

        int mini = min(ps[i - 1].y - ll, rr - ps[i - 1].y);
        mini = min(mini, disx[i - 1]);
        mini = min(mini, abs(ps[i - 1].y));

        tot += 1LL * mini * ps[i - 1].p;
    }

    return dp2[l][r] = tot;
}

void solve(const vector<Point>& ps, vector<int>& dis, vector<llint>& ans, int status) {
    int n = ps.size();
    int cntx = 0;
    for (int i = 0; i < n; i++) {
        if (status & (1 << i)) {
            cntx++;
        }
    }

    {
        llint tot = 0;
        for (int j = 0; j < n; j++) {
            tot += 1LL * dis[j] * ps[j].p;
        }
        ans[cntx] = min(ans[cntx], tot);
    }

    int cnty = n - cntx;

    memset(dp1, 0xFF & INFLL, sizeof(dp1));
    memset(dp2, 0xFF & INFLL, sizeof(dp2));
    dp1[0][0] = 0;

    /*
    for (int i = 1; i <= n; i++) {
        dp1[i][0] = dp1[i - 1][0] + 1LL * dis[i - 1] * ps[i - 1].p;
    }
    */

    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= cnty; j++) {
            for (int k = 0; k <= i - 1; k++) {
                dp1[i][j] = min(dp1[i][j], dp1[k][j - 1] + calc(ps, dis, k, i));
            }
        }
    }
    /*
    for (int i = 0; i <= n; i++) {
        for (int j = 0; j <= i; j++) {
            printf("%lld ", dp1[i][j]);
        }
        puts("");
    }
    puts("--");
    */

    // print(status);
    for (int i = 1; i <= cnty; i++) {
        for (int j = i; j <= n; j++) {
            ans[i + cntx] = min(ans[i + cntx], dp1[j][i] + calc(ps, dis, j, n + 1));
            // printf("%d %d, %lld %lld\n", j, i, dp1[j][i], calc(ps, dis, j, n + 1));
        }
    }
    // puts("--");
}

int main() {
    int n;
    vector<Point> ps;

    input(n);

    int x, y, p;
    for (int i = 0; i < n; i++) {
        scanf("%d%d%d", &x, &y, &p);
        ps.push_back({x, y, p});
    }

    vector<llint> ans(n + 1, INFLL);

    sort(ps.begin(), ps.end(), [](const Point& pa, const Point& pb) {
        return pa.y < pb.y;
    });

    for (int i = 0; i < (1 << n); i++) {
        vector<int> dis(n);

        for (int j = 0; j < n; j++) {
            dis[j] = min(abs(ps[j].y), abs(ps[j].x));
        }

        for (int j = 0; j < n; j++) {
            if ((i & (1 << j)) == 0) {
                continue;
            }
            for (int k = 0; k < n; k++) {
                dis[k] = min(dis[k], abs(ps[j].x - ps[k].x));
            }
        }

        solve(ps, dis, ans, i);
    }

    for (auto num: ans) {
        printf("%lld\n", num);
    }

    return 0;
}


Measured memory_bytes: 3776