#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
const ll INF = 1e12;
const int MAXN = 16;
int x[MAXN] , y[MAXN] , v[MAXN];
ll f1[1 << 15][MAXN] , f2[1 << 15][MAXN];
ll ans[MAXN];
int n;

class Point{
public:
	int pos;
	int v;
};

bool cmp(Point p1 , Point p2){
	return p1.pos < p2.pos;
}

Point g[MAXN + 10];

ll h[20][20];
int main(){
	ios::sync_with_stdio(0);
	cin >> n;
	for(int i = 1 ; i <= n ; ++ i)
		cin >> x[i] >> y[i] >> v[i];
	int S = (1 << n);
	int sum = 0;
	for(int i = 0 ; i <= n ; ++ i)
		ans[i] = INF;
	for(int i = 0 ; i < S ; ++ i){
		sum = 1;
		g[1].pos = 0; g[1].v = 0;
		for(int k = 0 ; k < n ; ++ k)
			if((1 << k) & i){
				++ sum;
				g[sum].pos = x[k + 1] , g[sum].v = v[k + 1];
			}
		sort(g + 1 , g + sum + 1 , cmp);
		int P = 0;
		for(int j = 1 ; j <= sum ; ++ j)
			if(g[j].pos == 0){
				P = j;
				break;
			}
		for(int j = 1 ; j <= P ; ++ j){
			h[j][1] = 0;
			for(int k = 1 ; k <= j ; ++ k)
				h[j][1] += 1ll * (g[j].pos - g[k].pos) * g[k].v;
		}
		for(int j = P + 1 ; j <= sum ; ++ j)
			h[j][1] = INF;
		for(int o = 2 ; o <= sum ; ++ o)
			for(int j = o ; j <= sum ; ++ j){
				h[j][o] = INF;
				if(j > P){
					for(int k = max(P , o - 1) ; k < j ; ++ k){
						ll now = h[k][o - 1];
						for(int t = k + 1 ; t < j ; ++ t)
							now += 1ll * min(g[t].pos - g[k].pos , g[j].pos - g[t].pos) * g[t].v;
						h[j][o] = min(h[j][o] , now);
					}
				}
				else{
					for(int k = o - 1 ; k < j ; ++ k){
						ll now = h[k][o - 1];
						for(int t = k + 1 ; t < j ; ++ t)
							now += 1ll * min(g[t].pos - g[k].pos , g[j].pos - g[t].pos) * g[t].v;
						h[j][o] = min(h[j][o] , now);
					}
				}
			}
		//cout << i << " " << h[2][2] << " " << P << " " << h[1][1] << endl;
		for(int o = 1 ; o <= sum ; ++ o)
			for(int j = o ; j <= sum ; ++ j){
				if(j < P)
					h[j][o] = INF;
				else
					for(int t = j + 1 ; t <= sum ; ++ t)
						h[j][o] += 1ll * (g[t].pos - g[j].pos) * g[t].v;
			}
		for(int o = 0 ; o <= n ; ++ o){
			f1[i][o] = INF;
			for(int j = o + 1 ; j <= sum ; ++ j){
				f1[i][o] = min(f1[i][o] , h[j][o + 1]);
		//		cout << i << " " << j << " " << o + 1 << " " << h[j][o + 1] << endl;
			}
		}
		sum = 1;
		g[1].pos = 0; g[1].v = 0;
		for(int k = 0 ; k < n ; ++ k)
			if((1 << k) & i){
				++ sum;
				g[sum].pos = y[k + 1] , g[sum].v = v[k + 1];
			}
		sort(g + 1 , g + sum + 1 , cmp);
		P = 0;
		for(int j = 1 ; j <= sum ; ++ j)
			if(g[j].pos == 0){
				P = j;
				break;
			}
		for(int j = 1 ; j <= P ; ++ j){
			h[j][1] = 0;
			for(int k = 1 ; k <= j ; ++ k)
				h[j][1] += 1ll * (g[j].pos - g[k].pos) * g[k].v;
		}
		for(int j = P + 1 ; j <= sum ; ++ j)
			h[j][1] = INF;
		for(int o = 2 ; o <= sum ; ++ o)
			for(int j = o ; j <= sum ; ++ j){
				h[j][o] = INF;
				if(j > P){
					for(int k = max(P , o - 1) ; k < j ; ++ k){
						ll now = h[k][o - 1];
						for(int t = k + 1 ; t < j ; ++ t)
							now += 1ll * min(g[t].pos - g[k].pos , g[j].pos - g[t].pos) * g[t].v;
						h[j][o] = min(h[j][o] , now);
					}
				}
				else{
					for(int k = o - 1 ; k < j ; ++ k){
						ll now = h[k][o - 1];
						for(int t = k + 1 ; t < j ; ++ t)
							now += 1ll * min(g[t].pos - g[k].pos , g[j].pos - g[t].pos) * g[t].v;
						h[j][o] = min(h[j][o] , now);
					}
				}
			}
		for(int o = 1 ; o <= sum ; ++ o)
			for(int j = o ; j <= sum ; ++ j){
				if(j < P)
					h[j][o] = INF;
				else
					for(int t = j + 1 ; t <= sum ; ++ t)
						h[j][o] += 1ll * (g[t].pos - g[j].pos) * g[t].v;
			}
		for(int o = 0 ; o <= n ; ++ o){
			f2[i][o] = INF;
			for(int j = o + 1 ; j <= sum ; ++ j){
				f2[i][o] = min(f2[i][o] , h[j][o + 1]);
			}
 		}
	}
	for(int i = 0 ; i < S ; ++ i)
		for(int j = 0 ; j <= n ; ++ j)
			for(int k = 0 ; j + k <= n ; ++ k)
				ans[j + k] = min(ans[j + k] , f1[i][j] + f2[(S - 1) ^ i][k]);
	for(int i = 0 ; i <= n ; ++ i)
		cout << ans[i] << endl;
	return 0;
}
/*
15
10000 10000 1000000
10000 10000 1000000
10000 10000 1000000
10000 10000 1000000
-10000 10000 1000000
10000 10000 1000000
10000 10000 1000000
10000 10000 1000000
-10000 10000 1000000
10000 10000 1000000
10000 10000 1000000
-10000 10000 1000000
10000 10000 1000000
10000 10000 1000000
-10000 10000 1000000
*/

Measured memory_bytes: 11848