# Original solution
import sys
def input(): return sys.stdin.readline().rstrip()

def main():
    n = int(eval(input()))
    li = []
    for _ in range(n):
        xi, yi, pi = list(map(int, input().split()))
        li.append([xi, yi, pi])
    li.sort(key=lambda x: x[2],reverse=True)
    xx=[[abs(li[j][0]) for j in range(n)] for i in range(2**n)]
    yy=[[abs(li[j][1]) for j in range(n)] for i in range(2**n)]
 
    for i in range(2**n):
        X=[0]
        rest=[]
        for j in range(n):
            if i>>j&1==1:
                X.append(li[j][0])
                xx[i][j]=0
            else:
                rest.append(j)
        for j in rest:
            res=10**15
            for k in X:
                res=min(res,abs(li[j][0]-k))
            xx[i][j]=res
    
    for i in range(2**n):
        Y=[0]
        rest=[]
        for j in range(n):
            if i>>j&1==1:
                Y.append(li[j][1])
                yy[i][j]=0
            else:
                rest.append(j)
        for j in rest:
            res=10**15
            for k in Y:
                res=min(res,abs(li[j][1]-k))
            yy[i][j]=res

    index_list=[2**q for q in range(n)]
    klist = [10**15]*(n+1)
    klist[n]=0 
    
    for xyr2 in range(3**n):
        xyr = xyr2
        k,xopen,yopen=0,0,0
        for index in range(n):            
            num = xyr%3
            k+= (num+1)//2
            xopen += (num%2)*index_list[index]
            yopen += (num//2)*index_list[index]
            xyr//=3 

        cost = 0
        for w in range(n):
            cost += min(xx[xopen][w], yy[yopen][w])*li[w][2]

        klist[k] = min(klist[k], cost)

    for g in range(n+1):
        print((klist[g]))


if __name__ == '__main__':
    main()

# Optimized solution
import sys
def input(): return sys.stdin.readline().rstrip()


def main():
    n = int(eval(input()))
    li = []
    for _ in range(n):
        xi, yi, pi = list(map(int, input().split()))
        li.append([xi, yi, pi])
    li.sort(key=lambda x: x[2], reverse=True)
    xx = [[abs(li[j][0]) for j in range(n)] for i in range(2**n)]
    yy = [[abs(li[j][1]) for j in range(n)] for i in range(2**n)]

    for i in range(2**n):
        X = [0]
        rest = []
        for j in range(n):
            if i >> j & 1 == 1:
                X.append(li[j][0])
                xx[i][j] = 0
            else:
                rest.append(j)
        for j in rest:
            res = 10**15
            for k in X:
                res = min(res, abs(li[j][0]-k))
            xx[i][j] = res

    for i in range(2**n):
        Y = [0]
        rest = []
        for j in range(n):
            if i >> j & 1 == 1:
                Y.append(li[j][1])
                yy[i][j] = 0
            else:
                rest.append(j)
        for j in rest:
            res = 10**15
            for k in Y:
                res = min(res, abs(li[j][1]-k))
            yy[i][j] = res

    index_list = [2**q for q in range(n)]
    klist = [10**15]*(n+1)
    klist[n] = 0
    xx=tuple(xx)
    yy=tuple(yy)

    for xyr2 in range(3**(n-1)):
        xyr = xyr2
        k, xopen, yopen = 0, 0, 0
        for index in range(n-1):
            xyr, num = divmod(xyr, 3)
            k += (num+1)//2
            xopen += (num % 2)*index_list[index]
            yopen += (num//2)*index_list[index]
        for app in range(3):
            k2, xopen2, yopen2 = k, xopen, yopen
            k2 += (app+1)//2
            xopen2 += (app % 2)*index_list[n-1]
            yopen2 += (app//2)*index_list[n-1]

            cost = 0
            for w in range(n):
                cost += min(xx[xopen2][w], yy[yopen2][w])*li[w][2]

            klist[k2] = min(klist[k2], cost)

    for g in range(n+1):
        print((klist[g]))


if __name__ == '__main__':
    main()