#include <iostream>
#include <array>
#include <algorithm>
#include <vector>
#include <bitset>
#include <set>
#include <unordered_set>
#include <cmath>
#include <complex>
#include <deque>
#include <iterator>
#include <numeric>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <string>
#include <tuple>
#include <utility>
#include <limits>
#include <iomanip>
#include <functional>
#include <cassert>
using namespace std;

using ll=long long;
template<class T> using V = vector<T>;
template<class T, class U> using P = pair<T, U>;
using vll = V<ll>;
using vvll = V<vll>;
#define rep(i, k, n) for (ll i=k; i<(ll)n; ++i)
#define REP(i, n) rep(i, 0, n)
#define ALL(v) v.begin(),v.end()
template < class T > inline bool chmax(T& a, T b) {if (a < b) { a=b; return true; } return false; }
template < class T > inline bool chmin(T& a, T b) {if (a > b) { a=b; return true; } return false; }
#define DEBUG_VLL(vec) REP(sz, vec.size()) std::cerr<<vec[sz]<<(sz==vec.size()-1?'\n':' ');

const long long MOD = 1000000007;
const long long HIGHINF = (long long)1e18;
const int INF = (int)1e9;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n; cin >> n;
    V< P<ll, P<ll, ll> > > xyp(n);
    for (int i = 0; i < n; i++) cin >> xyp[i].first >> xyp[i].second.first >> xyp[i].second.second;
    vll ans(n + 1, HIGHINF);
    ans[0] = 0;
    for (int i = 0; i < n; i++) {
        ans[0] += min(abs(xyp[i].first), abs(xyp[i].second.first)) * xyp[i].second.second;
    }

    
    V< V<ll> > xxx(1 << n, vll(n)), yyy(1 << n, vll(n));
    for (int state = 0; state < (1 << n); state++) {
        set<ll> x = {0};
        for (int i = 0; i < n; i++) {
            if (state >> i & 1) x.insert(xyp[i].first);
        }
        for (int i = 0; i < n; i++) {
            if (state >> i & 1) {
                xxx[state][i] = 0;
            } else {
                ll diff = HIGHINF;
                auto itx = x.lower_bound(xyp[i].first);
                if (itx != x.end()) chmin(diff, abs(*itx - xyp[i].first));
                if (itx != x.begin()) chmin(diff, abs(*(prev(itx)) -xyp[i].first));
                xxx[state][i] = diff;
            }
        }
        set<ll> y = {0};
        for (int i = 0; i < n; i++) {
            if (state >> i & 1) y.insert(xyp[i].second.first);
        }
        for (int i = 0; i < n; i++) {
            if (state >> i & 1) {
                yyy[state][i] = 0;
            } else {
                ll diff = HIGHINF;
                auto itx = y.lower_bound(xyp[i].second.first);
                if (itx != y.end()) chmin(diff, abs(*itx - xyp[i].second.first));
                if (itx != y.begin()) chmin(diff, abs(*(prev(itx)) -xyp[i].second.first));
                yyy[state][i] = diff;
            }
        }
    }
    
    for (int state = 1; state < (1 << n); state++) {
        for (int subs = state; subs >= 0; subs = (subs - 1) & state) {
            ll tmp = 0;
            for (int i = 0; i < n; i++) {
                tmp += min(xxx[subs][i], yyy[state ^ subs][i]) * xyp[i].second.second;
            }
            chmin(ans[__builtin_popcount(state)], tmp);
            if (subs == 0) break;
        }
    }
    for (int i = 0; i <= n; i++) cout << ans[i] << '\n';
    return 0;
}


Measured memory_bytes: 12944