/*
Arthor : Ender_zzm
E-mail zzm_ender_wiggin@outlook.com
Blog ender-zzm.enbar.cn
*/
#include <bits/stdc++.h>
using namespace std;

inline int read(){
    register int x = 0, flag = 1;
    register char ch;
    while (!isdigit(ch = getchar())) if (ch == '-') flag = -1;
    while (x = x * 10 + (ch & 15), isdigit(ch = getchar()));
	return x * flag;
}

template <class T>
inline void write(T x){
    if (x < 0)
        putchar('-'), x = -x;
    if(x >= 10) write(x / 10); 
    putchar(x % 10 + '0');
}

template<class T> inline bool Chkmax(T& x, const T& y) { return x < y ? x = y, true : false; }
template<class T> inline bool Chkmin(T& x, const T& y) { return x > y ? x = y, true : false; }

#define For(i, x, y) for (int i = (x); i <= (y); i++) 
#define Rep(i, x, y) for (int i = (x); i >= (y); i--) 

#define int long long
const int maxn = 20;
const int inf = 0x3f3f3f3f3f3f3f3f;
int x[maxn], y[maxn], p[maxn];
int pre[1 << 16];
int costt[1 << 16], dp[1 << 16][maxn];
int n;
struct Point {
	int val, id;
	bool operator < (const Point& a) const {
		return val < a.val;
	}
}tmp[maxn];
int cost(int K) {
	if (K == 0) return 0;
	int tot = 0, size = 0;
	for (int i = 0; i < n; i++) {
		if (K & (1 << i)) {
			tmp[++tot].val = i + 1;
			tmp[tot].id = i + 1;
			size += p[i + 1];
		}
	}
	int kk = inf;
	for (int i = 1; i <= tot; i++) {
		tmp[i].val = x[tmp[i].val];
	}
	sort(tmp + 1, tmp + 1 + tot);
	int pp = (size + 1) / 2, rnk = 0, now = 0;
	for (int i = 1; i <= tot; i++) {
		if (rnk + p[tmp[i].id] >= pp) {
			now = tmp[i].val;
			break;
		}
		else rnk += p[tmp[i].id];
	}
	int just = 0;
	for (int i = 1; i <= tot; i++) {
		just += abs(tmp[i].val - now) * p[tmp[i].id];
	}
//	printf("asd %lld %lld\n", now, just);	
	kk = min(kk, just);
	tot = 0, size = 0;
	for (int i = 0; i < n; i++) {
		if (K & (1 << i)) {
			tmp[++tot].val = i + 1;
			tmp[tot].id = i + 1;
			size += p[i + 1];
		}
	}
	for (int i = 1; i <= tot; i++) {
		tmp[i].val = y[tmp[i].val];
	}
	sort(tmp + 1, tmp + 1 + tot);
	pp = (size + 1) / 2, rnk = 0, now;
	for (int i = 1; i <= tot; i++) {
		if (rnk + p[tmp[i].id] >= pp) {
			now = tmp[i].val;
			break;
		}
		else rnk += p[tmp[i].id];
	}
	just = 0;
	for (int i = 1; i <= tot; i++) {
		just += abs(tmp[i].val - now) * p[tmp[i].id];
	}
	kk = min(kk, just);
	return kk;
}
int find(int S) {
	if (S == 0) return 0;
	int ans = 0;
	for (int k = 1; k <= n; k++) {
		if (S & (1 << (k - 1))) {
			ans += min(abs(x[k]), abs(y[k])) * p[k];
		}
	}
	return ans;
}
signed main() {
	n = read();
	for (int i = 1; i <= n; i++) {
		x[i] = read(), y[i] = read(), p[i] = read();
	}
	for (int S = 0; S < (1 << n); S++) {
		costt[S] = cost(S);
	}
	memset(dp, 0x3f, sizeof(dp));
	dp[0][0] = 0;
	for (int S = 0; S < (1 << n); S++) {
		for (int k = 1; k <= n; k++) {
			for (int cs = S; cs != 0; cs = (cs - 1) & S) {
				dp[S][k] = min(dp[S ^ cs][k - 1] + costt[cs], dp[S][k]);
			}
		}
	}
	int Big = (1 << n) - 1;
	//printf("%lld\n", dp[Big][1]);
	for (int k = 0; k <= n; k++) {
		int ans = inf;
		if (k == 0) {
			printf("%lld\n", find(Big));
			continue;
		}
		for (int i = 0; i <= Big; i++) {
			ans = min(ans, dp[i][k] + find(Big ^ i));
		}
		cout << ans << endl;
	}
	return 0;
}


Measured memory_bytes: 14176