#include <bits/stdc++.h>

using ll = long long;
const int maxn = 16;

int n;
struct pt {
    ll x, y, p;
    void read() {
        scanf("%lld%lld%lld", &x, &y, &p);
    }
} p[maxn];

ll d[1 << maxn][maxn][2], ans[maxn];

int main() {
    scanf("%d", &n);
    for(int i = 0; i < n; ++i) {
        p[i].read();
    }
    for(int i = 0; i <= n; ++i) {
        ans[i] = 1e18;
    }
    for(int s = 0; s < (1 << n); ++s) {
        for(int i = 0; i < n; ++i) {
            d[s][i][0] = std::abs(p[i].x);
            d[s][i][1] = std::abs(p[i].y);
            for(int j = 0; j < n; ++j) {
                if(~s & (1 << j))
                    continue;
                d[s][i][0] = std::min(d[s][i][0], std::abs(p[i].x - p[j].x));
                d[s][i][1] = std::min(d[s][i][1], std::abs(p[i].y - p[j].y));
            }
        }
    }
    for(int s = 0; s < (1 << n); ++s) {
        int w = __builtin_popcount(s);
        for(int u = s; u >= 0; u = (u - 1) & s) {
            int v = s ^ u;
            ll tot = 0;
            for(int i = 0; i < n; ++i) {
                tot += p[i].p * std::min(d[u][i][0], d[v][i][1]);
            }
            ans[w] = std::min(ans[w], tot);
            if(u == 0)
                break;
        }
    }
    for(int i = 0; i <= n; ++i) {
        printf("%lld\n", ans[i]);
    }
    return 0;
}