using System;
using System.Text;
using System.Diagnostics;
using System.Numerics;
using System.Collections.Generic;

class Myon

{
    public Myon() { }
    public static int Main()
    {
        cin = new Scanner();
        new Myon().calc();
        return 0;
    }
    static Scanner cin;


    void calc()
    {
        int N = cin.nextInt();
        int[] X = new int[N];
        int[] Y = new int[N];
        long[] P = new long[N];

        for (int i = 0; i < N; i++)
        {
            X[i] = cin.nextInt();
            Y[i] = cin.nextInt();
            P[i] = cin.nextInt();
        }

        long[,] XDist = new long[1 << N, N];
        long[,] YDist = new long[1 << N, N];

        long MAX = long.MaxValue / 2;

        for (int i = 0; i < (1 << N); i++)
        {
            for (int j = 0; j < N; j++)
            {
                XDist[i, j] = Math.Abs(X[j]) * P[j];
                YDist[i, j] = Math.Abs(Y[j]) * P[j];
                for (int k = 0; k < N; k++)
                {
                    if(((i >> k) & 1) == 1)
                    {
                        XDist[i, j] = Math.Min(XDist[i, j], Math.Abs(X[j] - X[k]) * P[j]) ;
                        YDist[i, j] = Math.Min(YDist[i, j], Math.Abs(Y[j] - Y[k]) * P[j]) ;
                    }
                }
            }
        }

        long[] ans = new long[N + 1];
        for (int i = 0; i < N + 1; i++)
        {
            ans[i] = MAX;
        }

        for (int i = 0; i < (1 << N); i++)
        {
            int bi = bitCount(i);
            for (int j = i; j >= 0; j--)
            {
                j &= i;
                int k = i - j;
                long sum = 0;
                for (int p = 0; p < N; p++)
                {
                    sum += Math.Min(XDist[k, p], YDist[j, p]);
                }
                ans[bi] = Math.Min(ans[bi], sum);
            }
        }

        for (int i = 0; i <= N; i++)
        {
            Console.WriteLine(ans[i]);
        }



    }

    int bitCount(long x)
    {
        x = (x & 0x5555555555555555) + (x >> 1 & 0x5555555555555555);
        x = (x & 0x3333333333333333) + (x >> 2 & 0x3333333333333333);
        x = (x & 0x0f0f0f0f0f0f0f0f) + (x >> 4 & 0x0f0f0f0f0f0f0f0f);
        x = (x & 0x00ff00ff00ff00ff) + (x >> 8 & 0x00ff00ff00ff00ff);
        x = (x & 0x0000ffff0000ffff) + (x >> 16 & 0x0000ffff0000ffff);
        return (int)((x & 0x00000000ffffffff) + (x >> 32 & 0x00000000ffffffff));
    }





}


class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }


    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


Measured memory_bytes: 35668