#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(long long)(n);++i)
#define all(a) a.begin(), a.end()
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
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; }
 
const ll MOD=1e9+7;
const ll INF=1e18;
const int MAX=510000;
const double pi=acos(-1);
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,-1,1,1,-1};
// int d[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
  
  int n;
  cin >> n;
  vector<ll>x(n),y(n),p(n); 
  rep(i,n) cin >> x[i] >> y[i] >> p[i]; 
  vector<ll>ans(n+1,1e18);
  
  vector<vector<ll>> distx(1<<n,vector<ll>(n));
  vector<vector<ll>> disty(1<<n,vector<ll>(n));
  for(int bit=0;bit<(1<<n);bit++){
    rep(i,n){
      distx[bit][i]=abs(x[i]);
      disty[bit][i]=abs(y[i]);
      rep(j,n){
        if(bit&(1<<j)){
          distx[bit][i]=min(distx[bit][i],abs(x[i]-x[j]));
          disty[bit][i]=min(disty[bit][i],abs(y[i]-y[j]));
        }
      }
    }
  }
  for(int bit=0;bit<(1<<n);++bit){
    int cnt = __builtin_popcount(bit);
    for(int i=bit;i>=0;--i){
      i&=bit;//bitで表せる選び方の部分集合i
      ll cost = 0;
      rep(j,n){
        if(!(i&(1<<j))){
          cost += min(distx[i][j],disty[bit-i][j])*p[j];
        }
      }
      ans[cnt]=min(ans[cnt],cost);
    }
  }
  rep(i,n+1) cout << ans[i] << endl;
  return 0;
}
