### BUGGY CODE ###

def main():
    import sys
    input = sys.stdin.readline
    N = int(input())
    T = [[int(i) for i in input().split()] for j in range(N)]
    X_dist = [[0]*N for _ in range(1 << N)]
    Y_dist = [[0]*N for _ in range(1 << N)]

    # bitという道路群を建設したときの，各集落の評価距離
    for bit in range(1 << N):
        cur_x = [0]
        for i in range(N):
            if bit & (1 << i):
                cur_x.append(T[i][0])
        for i, (x, _, p) in enumerate(T):
            X_dist[bit][i] = p*min(abs(cx - x) for cx in cur_x)

    # bitという道路群を建設したときの，各集落の評価距離
    for bit in range(1 << N):
        cur_y = [0]
        for i in range(N):
            if bit & (1 << i):
                cur_y.append(T[i][1])
        for i, (_, y, p) in enumerate(T):
            Y_dist[bit][i] = p*min(abs(cy - y) for cy in cur_y)

    def to_3(num):
        s = []
        while num > 0:
            s.append(str(num % 3))
            num //= 3
        return "{:0>15}".format("".join(s[::-1]))

    answer = [10**18] * (N+1)
    for bit in range(pow(3, N)):
        bit_S = to_3(bit)[-N:]
        x_bit = 0
        y_bit = 0
        x_set = set()
        y_set = set()
        for i in range(N):
            if bit_S[i] == "2":
                # x = a
                x_bit += 1 << i
                x_set.add(T[i][0])
            elif bit_S[i] == "1":
                # y = a
                y_bit += 1 << i
                y_set.add(T[i][1])
        cnt = len(x_set) + len(y_set)
        # 距離の評価
        cur_d = 0
        for i in range(N):
            cur_d += min(X_dist[x_bit][i], Y_dist[y_bit][i])
        answer[cnt] = min(answer[cnt], cur_d)

    for ans in answer:
        print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

# writer解(c++)を写経した．answerのfor文のところ何やってるかさっぱりわかりませんが…
# https://atcoder.jp/contests/m-solutions2020/submissions/15122924
import sys
input = sys.stdin.readline
INF = 10**13


def main():
    N = int(input())
    X = []
    Y = []
    P = []
    for _ in range(N):
        a, b, c = (int(i) for i in input().split())
        X.append(a)
        Y.append(b)
        P.append(c)
    X_dist = [[0]*N for _ in range(1 << N)]
    Y_dist = [[0]*N for _ in range(1 << N)]

    # bitという道路群を建設したときの，各集落の評価距離
    # bit 001001 とかの1が立っている集落に道を作る
    for bit in range(1 << N):
        for i in range(N):
            X_dist[bit][i] = P[i]*abs(X[i])
            Y_dist[bit][i] = P[i]*abs(Y[i])
            for k in range(N):
                if bit & (1 << k):
                    X_dist[bit][i] = \
                        min(X_dist[bit][i], P[i]*abs(X[i] - X[k]))
                    Y_dist[bit][i] = \
                        min(Y_dist[bit][i], P[i]*abs(Y[i] - Y[k]))

    # これはなに？
    answer = [INF] * (N+1)
    for i in range(1 << N):
        cnt = 0
        for j in range(N):
            if (i >> j) & 1:
                cnt += 1
        j = i
        while j >= 0:
            j &= i
            cost = 0
            for k in range(N):
                if not((i >> k) & 1):
                    cost += min(X_dist[j][k], Y_dist[i - j][k])
            answer[cnt] = min(answer[cnt], cost)
            j -= 1

    for ans in answer:
        print(ans)


if __name__ == '__main__':
    main()