package main

import (
  "bufio"
  "os"
  "strconv"
  "strings"
  "fmt"
)

func Solve() {
  var N int
  NextInt(&N)
  X := make([]int, N)
  Y := make([]int, N)
  P := make([]int, N)
  L := 0
  for i := range X {
    NextInt(&X[i], &Y[i], &P[i])
    L += MinInt(AbsInt(X[i]), AbsInt(Y[i])) * P[i]
  }
  V := make([][]int, 1 << uint(N))
  for v := range V {
    V[v] = make([]int, N)
    for i := range V[v] { V[v][i] = AbsInt(X[i]) * P[i] }
    for x, j := v, -1; x > 0; x /= 2 {
      j++
      if x % 2 == 0 { continue }
      for i := range V[v] { V[v][i] = MinInt(AbsInt(X[i] - X[j]) * P[i], V[v][i]) }
    }
  }
  H := make([][]int, 1 << uint(N))
  for h := range H {
    H[h] = make([]int, N)
    for i := range H[h] { H[h][i] = AbsInt(Y[i]) * P[i] }
    for y, j := h, -1; y > 0; y /= 2 {
      j++
      if y % 2 == 0 { continue }
      for i := range H[h] { H[h][i] = MinInt(AbsInt(Y[i] - Y[j]) * P[i], H[h][i]) }
    }
  }
  A := make([]int, N + 1)
  for i := range A { A[i] = L }
  Q := 1
  for i := 0; i < N; i++ { Q *= 3 }
  for q := 0; q < Q; q++ {
    v, h, c := 0, 0, 0
    for _q, i := q, -1; _q > 0; _q /= 3 {
      i++
      if _q % 3 == 0 { continue }
      c++
      if _q % 3 == 1 { v += 1 << uint(i) }
      if _q % 3 == 2 { h += 1 << uint(i) }
    }
    cnt := 0
    for _q, i := q, 0; i < N; i++ {
      if _q % 3 == 0 { cnt += MinInt(V[v][i], H[h][i]) }
      _q /= 3
    }
    A[c] = MinInt(cnt, A[c])
  }
  for _, a := range A { Write(a) }
}

func main() {
  Solve()
  Output()
}

var reader = bufio.NewReaderSize(os.Stdin, 1000000)
var writer = bufio.NewWriter(os.Stdout)
func NextLine() string {
  buffer := make([]byte, 0)
  for true {
    line, isPrefix, err := reader.ReadLine()
    if err != nil { panic(err) }
    buffer = append(buffer, line...)
    if !isPrefix { break }
  }
  return string(buffer)
}
func NextInt(A ...*int) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.Atoi(L[i])
  }
}
func NextIntSlice(A *[]int) {
  L := strings.Split(NextLine(), " ")
  if len(L) == 1 && L[0] == "" {
    (*A) = make([]int, 0)
    return
  }
  (*A) = make([]int, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.Atoi(l)
  }
}
func NextFloat(A ...*float64) {
  L := strings.Split(NextLine(), " ")
  for i, a := range A {
    *a, _ = strconv.ParseFloat(L[i], 64)
  }
}
func NextFloatSlice(A *[]float64) {
  L := strings.Split(NextLine(), " ")
  if len(L) == 1 && L[0] == "" {
    (*A) = make([]float64, 0)
    return
  }
  (*A) = make([]float64, len(L))
  for i, l := range L {
    (*A)[i], _ = strconv.ParseFloat(l, 64)
  }
}
func Write(S ...interface{}) {
  fmt.Fprintln(writer, S...)
}
func WriteIntSlice(A []int) {
  B := make([]interface{}, len(A))
  for i, a := range A { B[i] = a }
  fmt.Fprintln(writer, B...)
}
func Output() {
  _ = writer.Flush()
}
func MaxInt(A ...int) int {
  max := A[0]
  for _, a := range A {
    if max < a { max = a }
  }
  return max
}
func MinInt(A ...int) int {
  min := A[0]
  for _, a := range A {
    if a < min { min = a }
  }
  return min
}
func SumInt(A ...int) int {
  sum := 0
  for _, a := range A {
    sum += a
  }
  return sum
}
func AbsInt(x int) int {
  if x < 0 { x = -x }
  return x
}

Measured memory_bytes: 12100