#include <bits/stdc++.h>
using namespace std;
signed main(){
    int n;
    cin >> n;
    vector<long long> X(n),Y(n),P(n),T(n);
    long long U = 0;
    for(int i=0;i<n;i++){
        cin >> X[i] >> Y[i] >> P[i];
        T[i] = min(abs(X[i]),abs(Y[i]));
        U += P[i]*T[i];
    }
    vector<long long>L(n+1,U);
    int mask = (1<<n)-1;
    vector<vector<long long>> A(n, vector<long long>(1<<n,U)),B(n, vector<long long>(1<<n,U));
    for(int j=0;j<n;j++){
        for(int i=0;i<1<<n;i++){
            if((i>>j)&1){
                for(int q=0;q<n;q++){
                    A[q][i] = min(A[q][i],abs(X[q]-X[j]));
                    B[q][i] = min(B[q][i],abs(Y[q]-Y[j]));
                }
            }
        }
    }
    for(int i=0;i<1<<n;i++){
        int s = i ^ mask;
        for(int j=i;j>0;j=(j-1)&i){
            long long temp = 0;
            int cnt = 0;
            for(int k=0;k<n;k++){
                temp += P[k]*min(min(A[k][s],B[k][j]),T[k]);
                if(((s>>k)&1)|((j>>k)&1)) cnt += 1;
            }
            L[cnt] = min(L[cnt],temp);
        }
        long long temp = 0;
        int cnt = 0;
        for(int k=0;k<n;k++){
            temp += P[k]*min(A[k][s],T[k]);
            if((s>>k)&1) cnt += 1;
        }
        L[cnt] = min(L[cnt], temp);
    }
    for(int i=0;i<=n;i++) cout << L[i] << endl;
    return 0;
}