import sys

import numpy as np

import numba

from numba import njit

i8 = numba.int64



read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines



@njit((i8[:], ), cache=True)

def main(XYP):

    X, Y, P = XYP[::3], XYP[1::3], XYP[2::3]

    N = len(X)

    dp_X = np.empty((1 << N, N), np.int64)  # 建設、人 -> Xコスト

    dp_X[0] = np.abs(X) * P

    for n in range(N):

        B = 1 << n

        dp_X[B:2 * B] = np.minimum(dp_X[:B], np.abs(X - X[n]) * P)



    dp_Y = np.empty((1 << N, N), np.int64)  # 建設、人 -> Xコスト

    dp_Y[0] = np.abs(Y) * P

    for n in range(N):

        B = 1 << n

        dp_Y[B:2 * B] = np.minimum(dp_Y[:B], np.abs(Y - Y[n]) * P)



    popcount = np.zeros(1 << N, np.int64)

    for n in range(N):

        popcount[1 << n:1 << n + 1] = popcount[:1 << n] + 1



    INF = 10**18

    ans = np.full(N + 1, INF, np.int64)

    for s in range(1 << N):

        size = popcount[s]

        t = s

        while True:

            u = s ^ t

            cost = (np.minimum(dp_X[t], dp_Y[u])).sum()

            ans[size] = min(ans[size], cost)

            if t == 0:

                break

            t = (t - 1) & s

    return ans



N = int(readline())

XYP = np.array(read().split(), np.int64)



ans = main(XYP)

print(('\n'.join(map(str, ans.tolist()))))
import sys

import numpy as np



read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines



def main(XYP):

    X, Y, P = XYP[::3], XYP[1::3], XYP[2::3]

    N = len(X)

    dp_X = np.empty((1 << N, N), np.int64)  # 建設、人 -> Xコスト

    dp_X[0] = np.abs(X) * P

    for n in range(N):

        B = 1 << n

        dp_X[B:2 * B] = np.minimum(dp_X[:B], np.abs(X - X[n]) * P)



    dp_Y = np.empty((1 << N, N), np.int64)  # 建設、人 -> Xコスト

    dp_Y[0] = np.abs(Y) * P

    for n in range(N):

        B = 1 << n

        dp_Y[B:2 * B] = np.minimum(dp_Y[:B], np.abs(Y - Y[n]) * P)



    popcount = np.zeros(1 << N, np.int64)

    for n in range(N):

        popcount[1 << n:1 << n + 1] = popcount[:1 << n] + 1



    INF = 10**18

    ans = np.full(N + 1, INF, np.int64)

    for s in range(1 << N):

        size = popcount[s]

        t = s

        while True:

            u = s ^ t

            cost = (np.minimum(dp_X[t], dp_Y[u])).sum()

            ans[size] = min(ans[size], cost)

            if t == 0:

                break

            t = (t - 1) & s

    return ans



if sys.argv[-1] == 'ONLINE_JUDGE':

    import numba

    from numba.pycc import CC

    i8 = numba.int64

    cc = CC('my_module')



    def cc_export(f, signature):

        cc.export(f.__name__, signature)(f)

        return numba.njit(f)



    main = cc_export(main, (i8[:], ))

    cc.compile()



from my_module import main



N = int(readline())

XYP = np.array(read().split(), np.int64)



ans = main(XYP)

print(('\n'.join(map(str, ans.tolist()))))
import sys
import numpy as np
import numba
from numba import njit

i8 = numba.int64
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


@njit((i8[:],), cache=True)
def main(XYP):
    X, Y, P = XYP[::3], XYP[1::3], XYP[2::3]
    N = len(X)
    dp_X = np.empty((1 << N, N), np.int64)  # 建設、人 -> Xコスト
    dp_X[0] = np.abs(X) * P
    for n in range(N):
        B = 1 << n
        dp_X[B : 2 * B] = np.minimum(dp_X[:B], np.abs(X - X[n]) * P)
    dp_Y = np.empty((1 << N, N), np.int64)  # 建設、人 -> Xコスト
    dp_Y[0] = np.abs(Y) * P
    for n in range(N):
        B = 1 << n
        dp_Y[B : 2 * B] = np.minimum(dp_Y[:B], np.abs(Y - Y[n]) * P)
    popcount = np.zeros(1 << N, np.int64)
    for n in range(N):
        popcount[1 << n : 1 << n + 1] = popcount[: 1 << n] + 1
    INF = 10**18
    ans = np.full(N + 1, INF, np.int64)
    for s in range(1 << N):
        size = popcount[s]
        t = s
        while True:
            u = s ^ t
            cost = (np.minimum(dp_X[t], dp_Y[u])).sum()
            ans[size] = min(ans[size], cost)
            if t == 0:
                break
            t = (t - 1) & s
    return ans


N = int(readline())
XYP = np.array(read().split(), np.int64)
ans = main(XYP)
print(("\n".join(map(str, ans.tolist()))))

import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def main(XYP):
    X, Y, P = XYP[::3], XYP[1::3], XYP[2::3]
    N = len(X)
    dp_X = np.empty((1 << N, N), np.int64)  # 建設、人 -> Xコスト
    dp_X[0] = np.abs(X) * P
    for n in range(N):
        B = 1 << n
        dp_X[B : 2 * B] = np.minimum(dp_X[:B], np.abs(X - X[n]) * P)
    dp_Y = np.empty((1 << N, N), np.int64)  # 建設、人 -> Xコスト
    dp_Y[0] = np.abs(Y) * P
    for n in range(N):
        B = 1 << n
        dp_Y[B : 2 * B] = np.minimum(dp_Y[:B], np.abs(Y - Y[n]) * P)
    popcount = np.zeros(1 << N, np.int64)
    for n in range(N):
        popcount[1 << n : 1 << n + 1] = popcount[: 1 << n] + 1
    INF = 10**18
    ans = np.full(N + 1, INF, np.int64)
    for s in range(1 << N):
        size = popcount[s]
        t = s
        while True:
            u = s ^ t
            cost = (np.minimum(dp_X[t], dp_Y[u])).sum()
            ans[size] = min(ans[size], cost)
            if t == 0:
                break
            t = (t - 1) & s
    return ans


if sys.argv[-1] == "ONLINE_JUDGE":
    import numba
    from numba.pycc import CC

    i8 = numba.int64
    cc = CC("my_module")

    def cc_export(f, signature):
        cc.export(f.__name__, signature)(f)
        return numba.njit(f)

    main = cc_export(main, (i8[:],))
    cc.compile()
from my_module import main

N = int(readline())
XYP = np.array(read().split(), np.int64)
ans = main(XYP)
print(("\n".join(map(str, ans.tolist()))))

-import numba -from numba import njit -i8 = numba.int64 -@njit((i8[:],), cache=True) +if sys.argv[-1] == "ONLINE_JUDGE": +    import numba +    from numba.pycc import CC + +    i8 = numba.int64 +    cc = CC("my_module") + +    def cc_export(f, signature): +        cc.export(f.__name__, signature)(f) +        return numba.njit(f) + +    main = cc_export(main, (i8[:],)) +    cc.compile() +from my_module import main +