import Data.List
import Control.Monad
import Data.Set

data Axis = X|Y deriving Show
type City = [(Int,Int,Int)]
type RoadMap = [(Axis, Int)]

fst3 (x,y,z) = x
snd3 (x,y,z) = y

x -: f = f x

getInt = (fmap read) getLine :: IO Int
getInts = ((fmap ((fmap read) . words)) getLine) :: IO [Int]

getFromLines :: Int -> IO a -> IO [a]
getFromLines 0 _ = return []
getFromLines n getA = do
  a <- getA
  l <- getFromLines (n-1) getA
  return (a:l)

main = do
  n <- getInt
  city' <- getFromLines n getInts
  let city = fmap (\[x,y,w]->(x,y,w)) city'
  putStrLn $ [0..(n-1)] -: (fmap (\i-> show $ minCost i city)) -: (intercalate "\n")
  print 0

minCost :: Int -> City -> Int
minCost nRoad city =
  let xRange = city -: (fmap fst3) -: fromList -: toList in
  let yRange = city -: (fmap snd3) -: fromList -: toList in
  (roadCands nRoad xRange yRange) -: (fmap (\roadMap-> calcCost city ((X,0):(Y,0):roadMap))) -: minimum

calcCost :: City -> RoadMap -> Int
calcCost city roadMap =
  city -: (fmap (cityMinCost roadMap)) -: sum
  where
  cityMinCost :: RoadMap -> (Int,Int,Int) -> Int
  cityMinCost roadMap (x,y,w) = w * (roadMap -: (fmap (distance (x,y))) -: minimum)
  distance:: (Int,Int) -> (Axis, Int) -> Int
  distance (x,y) (X, x') = abs (x-x')
  distance (x,y) (Y, y') = abs (y-y')

roadCands :: Int -> [Int] -> [Int] -> [RoadMap]
roadCands nRoad xRange yRange = chose
  ((xRange -: (fmap (\x->(X,x)))) ++ (yRange -: (fmap (\y->(Y,y)))) :: [(Axis, Int)])
  nRoad

chose :: [a] -> Int -> [[a]]
chose l 0 = [[]]
chose [] k = []
chose (x:xs) k = (chose xs k) ++ ((chose xs (k-1)) -: (fmap (x:)))
