#pragma GCC optimize(2)

#include <cmath>
#include <cstdio>
#include <cctype>
#include <cstring>

#include <set>
#include <queue>
#include <complex>
#include <algorithm>

int read(void){
	int res = 0, sign = 1;
	char ch = std::getchar();
	while(!std::isdigit(ch)){
		if(ch == '-')
			sign = -1;
		ch = std::getchar();
	}
	while(std::isdigit(ch))
		res = res * 10 + ch - 48, ch = std::getchar();
	return sign * res;
}

template<class Tp>
	void write(const Tp &x){
		if(x > 9)
			write(x / 10);
		std::putchar(x % 10 + 48);
	}

typedef long long ll;
typedef unsigned long long ull;
typedef double rl;
typedef long double RL;

const rl PI = 3.1415926535898, E = 2.71828182845904;

const int MAXN = 18;

ll ans[MAXN];
int dist[MAXN];

int n;
int x[MAXN], y[MAXN], p[MAXN];
int in[MAXN];

int main(){
	n = read();
	for(int i = 1; i <= n; ++i)
		x[i] = read(), y[i] = read(), p[i] = read();
	for(int i = 0; i <= n; ++i)
		ans[i] = 1e18;
	for(int i = 0; i < (1 << n); ++i){
		int cnt = 0;
		for(int j = 1; j <= n; ++j)
			if(i & (1 << (j - 1)))
				in[++cnt] = j;
		for(int j = 0; j < (1 << cnt); ++j){
			for(int p = 1; p <= n; ++p)
				dist[p] = std::min(int(std::abs(x[p])), int(std::abs(y[p])));
			for(int k = 1; k <= cnt; ++k)
				if(j & (1 << (k - 1)))
					for(int p = 1; p <= n; ++p)
						dist[p] = std::min(dist[p], int(std::abs(x[p] - x[in[k]])));
				else
					for(int p = 1; p <= n; ++p)
						dist[p] = std::min(dist[p], int(std::abs(y[p] - y[in[k]])));
			ll s = 0ll;
			for(int j = 1; j <= n; ++j)
				s += (ll)dist[j] * p[j];
			ans[cnt] = std::min(ans[cnt], s);
		}
	}
	for(int i = 0; i <= n; ++i)
		std::printf("%lld\n", ans[i]);
	return 0;
}