#include<bits/stdc++.h>
using namespace std;
const int N=20;
long long ans[N];
long long x[N],y[N],w[N];
int ffx[4][2]={{0,1},{0,-1},{1,0},{-1,0}};
int oo=1e9;
int main() {
freopen("equinox.in","r",stdin);
freopen("equinox.out","w",stdout);
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
scanf("%lld%lld%lld", &x[i], &y[i], &w[i]);
}
if (n == 1) {
cout << w[1] << endl;
} else {
if (n == 2) {
int ans = -oo;
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 4; j++) {
ans = max(1LL*ans, w[1] + w[2] - abs(x[1] - x[2] + ffx[i][0] - ffx[j][0]) - abs(y[1] - y[2] + ffx[i][1] - ffx[j][1]));
}
}
cout<<max(w[1],w[2])<<' '<<ans<<endl;
}else{
for(int i=0;i<(1<<n);i++){
int MX=-oo,MN=oo,tot=0;
long long sum=0;
for(int j=1;j<=n;j++){
if((1<<(j-1))&i){
tot++;
MX=max(1ll*MX,y[j]);
MN=min(1ll*MN,y[j]);
sum+=w[j];
}
}
if(MX==MN){
ans[tot]=max(ans[tot],sum);
}else{
ans[tot]=max(ans[tot],sum-(MX-MN-1));
}
}
for(int i=1;i<=n;i++){
cout<<ans[i]<<' ';
}
}
}
}