#include<bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long int
// #define ll long long int
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define pb push_back
#define eb emplace_back
#define pii pair<int, int>
#define endl '\n'
#define all(x) x.begin(),x.end()
#define f(i,j,l) for(i=j;i<l;i++)
#define smax(a,b) a=max(a,b)
// #if !defined(ONLINE_JUDGE)
// #include "debugging.h"
// #endif
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// find_by_order(k)  returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;
// erase,insert same as normal set

// int const mod = 7340033;
// int const mod = 998244353;
long long const mod = 1e9+7;
int power(int a,int b,int m){
    int res = 1;
    while(b){
        if(b&1){
            // res = res*a;
            res = (res*a)%m;
        }
        a=(a*a)%m;
        // a%=m;
        b=b/2;
    }
    return res;
}

int inverse(int x , int m){
    return power(x,m-2,m);
}

int const N = 5e5+5;
int const inf = 2e11;

void solve(){  
    int i,j;   
    int n;
    cin >> n;
    vector<pair<pii, int> > v(n);
    vector<pii> x1,y1;
    for(auto &p:v){
        cin >> p.first.first >> p.first.second >> p.second;
    }

    for(i=0;i<n;i++){
        x1.pb({v[i].first.first , i});
        y1.pb({v[i].first.second , i});
    }

    sort(all(x1));
    sort(all(y1));

    int ans[n+1];

    for(i=0;i<=n;i++){
        ans[i] = inf;
    }   

    vector<int> a[(1LL<<n)];
    vector<int> b[(1LL<<n)];

    for(int mask=0;mask < (1LL<<n);mask++){
        vector<int> xx;
        xx.pb(-inf);
        xx.pb(0);
        xx.pb(inf);

        for(i=0;i<n;i++){
            if(mask&(1LL<<i)){
                xx.pb(v[i].first.first);
            }
        }
        sort(all(xx));

        int mn[n];
        for(i=0;i<n;i++){
            mn[i] = inf;
        }
        j = 1;
        for(auto p:x1){
            int p1 = v[p.second].second;
            int dis1;
            while(xx[j] < p.first){
                j++;
            }
            dis1 = min(xx[j] - p.first , p.first - xx[j-1]);
            // cout<<p.first<<" "<<p.second<<" "<<dis1<<" "<<p1<<" "<<cnt<<endl;
            mn[p.second] = min(mn[p.second] , dis1*p1);
        }

        for(i=0;i<n;i++){
            a[mask].pb(mn[i]);
        }
    }

    for(int mask=0;mask < (1LL<<n);mask++){
        vector<int> yy;
        yy.pb(-inf);
        yy.pb(0);
        yy.pb(inf);

        for(i=0;i<n;i++){
            if(mask&(1LL<<i)){
                yy.pb(v[i].first.second);
            }
        }
        sort(all(yy));

        int mn[n];
        for(i=0;i<n;i++){
            mn[i] = inf;
        }
        j = 1;
        for(auto p:y1){
            int p1 = v[p.second].second;
            int dis1;
            while(yy[j] < p.first){
                j++;
            }
            dis1 = min(yy[j] - p.first , p.first - yy[j-1]);
            // cout<<p.first<<" "<<p.second<<" "<<dis1<<" "<<p1<<" "<<cnt<<endl;
            mn[p.second] = min(mn[p.second] , dis1*p1);
        }

        for(i=0;i<n;i++){
            b[mask].pb(mn[i]);
        }
    }

    for(int maska = 0;maska < (1LL<<n);maska++){
        int m1 = ((1LL<<n)-1) - maska;

        for(int maskb=m1; ; maskb = (maskb-1)&m1){
            int res = 0;
            int cnt = __builtin_popcount(maska) + __builtin_popcount(maskb);
            for(i=0;i<n;i++){
                res = res + min(a[maska][i] , b[maskb][i]);
            }
            ans[cnt] = min(ans[cnt] , res);

            if(maskb == 0) break;
        }
    }
    
    for(i=0;i<=n;i++){
        cout<<ans[i]<<endl;
    }
}        



int32_t main(){
    IOS;
    int t;
    t = 1;
    // precompute();
    // cin>>t;  
    for(int tt=1;tt<=t;tt++){
        solve();
    }
    return 0;
}


/*


*/

Measured memory_bytes: 14328