
#include <bits/stdc++.h>
#define rep(i,n) for (ll i = 0; i < n; ++i)
using namespace std;
typedef long long ll;
typedef pair<ll,int> P;
const ll INF=1e18;

int main() {
  ll n;
  cin>>n;
  vector<ll> x(n);
  vector<ll> y(n);
  vector<ll> p(n);
  rep(i,n){
    ll x1,y1,p1;
    cin>>x1>>y1>>p1;
    x[i]=x1;y[i]=y1;p[i]=p1;
  }

  vector<ll> ans(n+1);
  rep(i,n+1)ans[i]=INF;
  vector<vector<ll>> xmin((1<<n), vector<ll>(n));
  vector<vector<ll>> ymin((1<<n), vector<ll>(n));
  rep(i,(1<<n)){
    rep(k,n){//各てん
      ll xnow=abs(x[k]); ll ynow=abs(y[k]);

      rep(j,n){

        if (!((i>>j)&1))continue;
      //  cout<<"j"<<j<<endl;

        xnow=min(xnow,abs(x[k]-x[j]));
        ynow=min(ynow,abs(y[k]-y[j]));

      }
  //    cout<<"i"<<i<<"k"<<k<<endl;
    //  cout<<"xnow"<<xnow<<endl;
    //  cout<<"ynow"<<ynow<<endl;

      xmin[i][k]=xnow;
      ymin[i][k]=ynow;
    }
  }


  rep(i,(1<<n)){
  //  cout<<"i"<<i<<endl;
    ll cnt=0;
    rep(j,n){
      if ((i>>j)&1) cnt++;
    }
  //  cout<<"cnt"<<cnt<<endl;
    for(ll j=i;j>=0;j--){
      j&=i;
  //    cout<<"j"<<j<<endl;
      ll a=0;
      rep(k,n){
        ll temp=min(xmin[i-j][k],ymin[j][k]);
        a+=temp*p[k];
      }

      ans[cnt]=min(ans[cnt],a);
  //    cout<<ans[cnt]<<endl;

    }
  }

rep(i,n+1)cout<<ans[i]<<endl;


}
