#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(9), 0);
//int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv ./prog.exe") >> 8), 0);
const Int INF = 1e18;
vector<Int> X, Y, P;
Int N, D[30][30], curr, cnt, ans[30];
void recur(int xory, int i) {
    if (i == N && xory == 1) return;
    if (i == N) { recur(1, 0); return; }
    recur(xory, i + 1);
    if (D[i][cnt] != 0) {
        auto& Z = (xory == 0 ? X : Y);
        Int a = 0;
        for (int t = 0; t < N; t++) {
            D[t][cnt + 1] = min(D[t][cnt], abs(Z[i] - Z[t]));
            a += D[t][cnt + 1] * P[t];
        }
        ans[cnt + 1] = min(ans[cnt + 1], a);
        cnt++;
        recur(xory, i + 1);
        cnt--;
    }
}
int main() {
    cin >> N;
    X.resize(N), Y.resize(N), P.resize(N);
    for (int i = 0; i < N; i++) cin >> X[i] >> Y[i] >> P[i];
    for (int i = 0; i < N; i++) {
        D[i][0] = min(abs(X[i]), abs(Y[i]));
        curr += D[i][0] * P[i];
    }
    for (int i = 0; i <= N; i++) {
        ans[i] = INF;
    }
    ans[0] = curr;
    recur(0, 0);
    for (int i = 0; i <= N; i++) {
        cout << (ans[i] == INF ? 0 : ans[i]) << '\n';
    }
    return 0;
}
