#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using vl = vector<ll>;
template<class T> using vc = vector<T>;
template<class T> using vvc = vector<vector<T>>;

#define eb emplace_back
#define all(x) (x).begin(), (x).end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define repr(i, n) for (ll i = (n)-1; i >= 0; i--)
#define repe(i, l, r) for (ll i = (l); i < (r); i++)
#define reper(i, l, r) for (ll i = (r)-1; i >= (l); i--)
#define repa(i,n) for (auto& i: n)

template<class T> inline bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> inline bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
void init() {cin.tie(0);ios::sync_with_stdio(false);cout << fixed << setprecision(15);}

#ifdef DEBUG
template <class T, class N> void verr(const T& a, const N& n) { rep(i, n) cerr << a[i] << " "; cerr << "\n" << flush; }
ll dbgt = 1; void err() { cerr << "passed " << dbgt++ << "\n" << flush; }
template<class H, class... T> void err(H&& h,T&&... t){ cerr<< h << (sizeof...(t)?" ":"\n") << flush; if(sizeof...(t)>0) err(forward<T>(t)...); }
#endif

const ll INF = 4e18;
const ld EPS = 1e-11;
const ld PI = acos(-1.0L);
const ll MOD = 1e9 + 7;
// const ll MOD = 998244353;
//--------------------------------------------------------------------------------//
using arr = array<ll, 3>;

int main() {
    init();
    ll N;
    map<string, vl> m1, m2;
    cin >> N;
    vc<arr> A(N);
    vl ans(N + 1, INF);

    rep(i, N) cin >> A[i][0] >> A[i][1] >> A[i][2];

    ll n1 = N / 2, n2 = (N + 1) / 2;

    vl tmp(N);
    rep(i, N) tmp[i] = min(abs(A[i][0]), abs(A[i][1])) * A[i][2];
    queue<pair<string, vl>> q;

    // n1
    q.emplace("", tmp);
    while(!q.empty()){
        string s; vl C;
        tie(s, C) = q.front();
        q.pop();
        if (s.size() == n1){
            m1[s] = C;
            continue;
        }

        ll n = s.size();
        auto [x, y, c] = A[n];
        q.emplace(s + "0", C);

        vl D = C;
        rep(i, N) chmin(D[i], abs(A[i][0] - x) * A[i][2]);
        q.emplace(s + "1", D);

        rep(i, N) chmin(C[i], abs(A[i][1] - y) * A[i][2]);
        q.emplace(s + "2", C);
    }

    // n2
    q.emplace("", tmp);
    while (!q.empty()) {
        auto[s, C] = q.front();
        q.pop();
        if (s.size() == n2){
            m2[s] = C;
            continue;
        }

        ll n = s.size();
        auto [x, y, c] = A[n + n1];
        q.emplace(s + '0', C);

        vl D = C;
        rep(i, N) chmin(D[i], abs(A[i][0] - x) * A[i][2]);
        q.emplace(s + '1', D);

        rep(i, N) chmin(C[i], abs(A[i][1] - y) * A[i][2]);
        q.emplace(s + '2', C);
    }

    repa(p1, m1){
        string s1 = p1.first;
        vl a = p1.second;
        repa(p2, m2){
            string s2 = p2.first;
            vl b = p2.second;
            ll cnt = 0;
            repa(c, s1) if (c != '0') cnt++;
            repa(c, s2) if (c != '0') cnt++;

            rep(i, n1) rep(j, N){
                if(s1[i]=='1'){
                    chmin(b[j], abs(A[j][0] - A[i][0]) * A[j][2]);
                }else if(s1[i]=='2'){
                    chmin(b[j], abs(A[j][1] - A[i][1]) * A[j][2]);
                }
            }

            chmin(ans[cnt], accumulate(all(b), 0ll));
        }
    }

    rep(i, N + 1) cout << ans[i] << endl;
}

Measured memory_bytes: 5624