#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
vector<ll> f(int N, const vector<vector<ll>>& xx, int pp) {
	vector<int> idx;
	for (int i = 0; i < N; ++ i) if ((pp>>i)&1) idx.push_back(i);
	int n = idx.size();
	vector<ll> res(n+1, 1LL<<62);
	for (int p = 0; p < (1<<n); ++ p) {
		int cnt = __builtin_popcount(p);
		int q = 0;
		for (int i = 0; i < n; ++ i) if ((p>>i)&1) q |= 1<<idx[i];
		ll d = 0;
		for (int i : idx) {
			d += xx[i][q];
		}
		res[cnt] = min(res[cnt], d);
	}
	return res;
}
ll g(const vector<ll>& x, int pp, int i) {
	ll dd = abs(x[i]);
	for (unsigned j = 0; j < x.size(); ++ j) if ((pp>>j)&1) {
		dd = min(dd, abs(x[i]-x[j]));
	}
	return dd;
}
int main() {
	int N;
	cin >> N;
	vector<ll> X(N), Y(N), P(N);
	for (int i = 0; i < N; ++ i) cin >> X[i] >> Y[i] >> P[i];
	vector<vector<ll>> xx(N, vector<ll>(1<<N)), yy(N, vector<ll>(1<<N));
	for (int i = 0; i < N; ++ i) {
		for (int p = 0; p < (1<<N); ++ p) {
			xx[i][p] = g(X, p, i) * P[i];
			yy[i][p] = g(Y, p, i) * P[i];
		}
	}
	vector<ll> ans(N+1, 1LL<<62);
	for (int p = 0; p < (1<<N); ++ p) {
		auto ax = f(N, xx, p);
		auto ay = f(N, yy, ((1<<N)-1)&~p);
		for (int i = 0; i < (int)ax.size(); ++ i) {
			for (int j = 0; j < (int)ay.size() && i+j <= N; ++ j) {
				ans[i+j] = min(ans[i+j], ax[i] + ay[j]);
			}
		}
	}
	for (auto x : ans) cout << x << endl;
}
