#include <cstdio>
#include <string>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <cassert>
#include <numeric>
#include <functional>
#include <time.h>
#pragma warning(disable:4996) 

typedef long long ll;
typedef unsigned long long ull;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF  9223300000000000000
#define LINF2 1223300000000000000
#define LINF3 1000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;

using namespace std;

ll ans0[1 << 15][15];
ll ans1[1 << 15][15];

ll dp[16][16];
ll b[16][16];

ll calc2(int num, const pair<int, int>* z)
{
    assert(num > 0);
    vector<ll> ss(num + 1);
    int i;
    for (i = 0; i < num; i++) {
        ss[i+1]=ss[i]+z[i].second;
    }
    ll tmp=ss[num] / 2;
    for (i = 0; i <= num; i++) {
        if (ss[i] > tmp) break;
    }
    int id=i-1;
    ll ans = 0;
    for (i = 0; i < num; i++) {
        ans += (ll)abs(z[i].first - z[id].first)*z[i].second;
    }
    return ans;
}

void calc(vector<pair<int, int> >& z, ll aa[16])
{
    int num = (int)z.size();
    sort(z.begin(), z.end());

    int i,j;
    if (num == 0) {
        for (i = 0; i <= num; i++) {
            aa[i] = 0;
        }
        return;
    }
    for (i = 0; i <=num; i++) {
        for (j = 0; j <=num; j++) {
            dp[i][j] = LINF;
        }
    }

    vector<ll> s(num + 1);
    for (i = 0; i < num; i++) {
        int x = z[i].first;
        int p = z[i].second;
        ll tmp=abs(x)*(ll)p;
        s[i + 1] = s[i] + tmp;
    }

    for (i = 0; i <=num; i++) {
        dp[0][i] = 0;
    }

    for (i = 0; i < num; i++) {
        for (j = i + 1; j <= num; j++) {
            b[i][j]=calc2(j - i, &(z[i]));
        }
    }

    for (i = 0; i < num; i++) {
        int k;
        for (k = 0; k <=num; k++) {
            if (dp[i][k] == LINF) continue;

            for (j = i + 1; j <= num; j++) {

                {
                    ll add = s[j] - s[i];
                    dp[j][k]=MIN(dp[j][k], dp[i][k] + add);
                }

                if(k<num) {
                    ll add = b[i][j];
                    dp[j][k+1]=MIN(dp[j][k+1], dp[i][k] + add);
                }
            }
        }
    }

    for (i = 0; i <=num; i++) {
        aa[i]=dp[num][i];
    }
    return;
}

void solve()
{
    int n;
    scanf("%d", &n);
    vector<int> x(n), y(n), P(n);
    int i;
    for (i = 0; i < n; i++) {
        scanf("%d%d%d", &x[i], &y[i], &P[i]);
    }

    int j;
    for (i = 0; i < (1 << n); i++) {
        vector<pair<int, int> > z;
        for (j = 0; j < n; j++) {
            if (i & (1 << j)) {
                z.push_back(make_pair(x[j], P[j]));
            }
        }
        calc(z, ans0[i]);
    }

    for (i = 0; i < (1 << n); i++) {
        vector<pair<int, int> > z;
        for (j = 0; j < n; j++) {
            if (i & (1 << j)) {
                z.push_back(make_pair(y[j], P[j]));
            }
        }
        calc(z, ans1[i]);
    }

    vector<ll> ans(n+1, LINF);
    for (i = 0; i <= n; i++) {
        for (j = 0; j <= n; j++) {
            int p = i + j;
            if (p > n) continue;

            int k;
            for (k = 0; k < (1 << n); k++) {
                int k2 = (1 << n) - 1 - k;
                ll val=ans0[k][i] + ans1[k2][j];
                ans[p] = MIN(ans[p], val);
            }
        }
    }
    for (i = 0; i <= n; i++) {
        printf("%lld\n", ans[i]);
    }

    return;
}

int main()
{
#if 1
    solve();
#else
    int T;
    scanf("%d", &T);
    int t;
    for (t = 0; t < T; t++) {
        solve();
    }
#endif
    return 0;
}


Measured memory_bytes: 10924