#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for(int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    ll n;
    cin >> n;
    ll x[n], y[n], p[n];
    rep(i,n)cin >> x[i] >> y[i] >> p[i];

    ll ans[n+1];
    ll INF = 1001001001001001001;
    rep(i,n+1)ans[i] = INF;

    rep(loop,1<<n){
        bitset<20> f(loop);
        vector<P> v[4];
        rep(i,n){
            if(f[i] == 0){
                if(x[i] >= 0){
                    v[0].push_back(P(x[i],p[i]));
                }else{
                    v[1].push_back(P(-x[i],p[i]));
                }
            }else{
                if(y[i] >= 0){
                    v[2].push_back(P(y[i],p[i]));
                }else{
                    v[3].push_back(P(-y[i],p[i]));
                }
            }
        }

        rep(i,4){
            sort(v[i].begin(), v[i].end());
        }

        ll dpp[n+1][4];
        rep(i,n+1){
            rep(j,4){
                dpp[i][j] = INF;
            }
        }

        rep(i,4){
            int nn = v[i].size();
            if(nn == 0){
                dpp[0][i] = 0;
                continue;
            }
            ll dp[n+1][n+1];
            rep(j,n+1){
                rep(k,n+1){
                    dp[j][k] = INF;
                }
            }
            rep(j,nn){
                ll xx = v[i][j].first;
                ll pp = v[i][j].second;
                if(j == 0){
                    dp[j][0] = xx * pp;
                    dp[j][1] = 0;
                }else{
                    rep(k,n+1){
                        if(k == 0){
                            dp[j][k] = dp[j-1][k] + xx * pp;
                        }else{
                            rep(l,j+1){
                                ll sum = 0;
                                srep(m,l,j+1){
                                    sum += v[i][m].second;
                                }
                                sum = sum / 2 + 1;
                                ll mm = -1;
                                srep(m,l,j+1){
                                    sum -= v[i][m].second;
                                    if(sum <= 0){
                                        mm = v[i][m].first;
                                        break;
                                    }
                                }

                                ll tmp = 0;
                                srep(m,l,j+1){
                                    tmp += (ll)abs(mm-v[i][m].first) * v[i][m].second;
                                }

                                if(l == 0){
                                    dp[j][k] = min(dp[j][k], tmp);
                                }else{
                                    dp[j][k] = min(dp[j][k], dp[l-1][k-1] + tmp);
                                }

                            }
                        }
                    }
                }
            }


            rep(j,n+1){
                dpp[j][i] = dp[nn-1][j];
            }
            
        }

        int  nn[4];
        rep(i,4){
            nn[i] = v[i].size()+1;
        }

        rep(i,nn[0]){
            rep(j,nn[1]){
                rep(k,nn[2]){
                    rep(l,nn[3]){
                        ans[i+j+k+l] = min(ans[i+j+k+l], dpp[i][0]+dpp[j][1]+dpp[k][2]+dpp[l][3]);
                    }
                }
            }
        }


    }

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




Measured memory_bytes: 3632