#line 1 "template.cpp"
#ifdef LOCAL
    #define _GLIBCXX_DEBUG
#else
    #pragma GCC optimize("O3")
    #pragma GCC target("avx,avx2")
    #pragma GCC optimize("unroll-loops")
#endif
// #define NDEBUG

#include <bits/stdc++.h>
#line 12 "template.cpp"

#line 4 "C:/Users/euler/Documents/competitive_programming/Library/config.hpp"

namespace config
{
    const auto start_time{std::chrono::system_clock::now()};
    int64_t elapsed()
    {
        using namespace std::chrono;
        const auto end_time{std::chrono::system_clock::now()};
        return duration_cast<milliseconds>(end_time - start_time).count();
    }
    __attribute__((constructor)) void setup()
    {
        using namespace std;
        ios::sync_with_stdio(false);
        cin.tie(nullptr);
        cout << fixed << setprecision(15);
        #ifdef _stdin_path
            if(!freopen(_stdin_path, "r", stdin)) freopen("CON", "r", stdin);
        #endif
        #ifdef _buffer_check
            atexit([]{ ofstream cnsl("CON"); char bufc; if(cin >> bufc) cnsl << "\n\033[1;35mwarning\033[0m: buffer not empty.\n\n"; });
        #endif
    }
}

unsigned __cases(); template <class C> void main_() { for(unsigned t = __cases(); t; --t) C(); }
struct solver; int main() { main_<solver>(); }
#line 1 "C:/Users/euler/Documents/competitive_programming/Library/utils/fixed_point.hpp"
template <class lambda_type>
class fixed_point
{
    lambda_type func;
public:
    fixed_point(lambda_type &&f) : func(std::move(f)) {}
    template <class... Args> auto operator()(Args &&... args) const { return func(*this, std::forward<Args>(args)...); }
};
#line 1 "C:/Users/euler/Documents/competitive_programming/Library/utils/read.hpp"
// read with std::cin.
template <class T = void>
struct read
{
    typename std::remove_const<T>::type value;
    template <class... types>
    read(types... args) : value(args...) { std::cin >> value; }
    operator T() const { return value; }
};
template <>
struct read<void>
{
    template <class T>
    operator T() const { T value; std::cin >> value; return value; }
};
#line 2 "C:/Users/euler/Documents/competitive_programming/Library/utils/chval.hpp"

template <class T, class Comp = std::less<T>> bool chle(T &x, const T &y, Comp comp = Comp()) { return comp(y, x) ? x = y, true : false; }
template <class T, class Comp = std::less<T>> bool chge(T &x, const T &y, Comp comp = Comp()) { return comp(x, y) ? x = y, true : false; }
#line 1 "C:/Users/euler/Documents/competitive_programming/Library/utils/binary_search.hpp"
// binary search on discrete range.
template <class iter_type, class pred_type>
iter_type binary(iter_type __ok, iter_type __ng, pred_type pred)
{
    assert(__ok != __ng);
    long long dist(__ng - __ok);
    while(std::abs(dist) > 1)
    {
        iter_type mid(__ok + dist / 2);
        if(pred(mid)) __ok = mid, dist -= dist / 2;
        else __ng = mid, dist /= 2;
    }
    return __ok;
}

// binary search on real numbers.
template <class pred_type>
long double binary(long double __ok, long double __ng, const long double eps, pred_type pred)
{
    assert(__ok != __ng);
    while(std::abs(__ok - __ng) > eps)
    {
        long double mid{(__ok + __ng) / 2};
        (pred(mid) ? __ok : __ng) = mid;
    }
    return __ok;
}
#line 18 "template.cpp"

#pragma region using
using namespace std;
using namespace __gnu_cxx;
using i32 = int_least32_t; using i64 = int_least64_t;
using p32 = pair<i32, i32>; using p64 = pair<i64, i64>;
template <class T, class Comp = less<T>> using heap = priority_queue<T, vector<T>, Comp>;
template <class T> using hashset = unordered_set<T>;
template <class Key, class Value> using hashmap = unordered_map<Key, Value>;
#pragma endregion

unsigned __cases()
{
    unsigned t = 1;
    // t = -1;
    // cin >> t;
    return t;
}



struct solver
{

    static constexpr i64 inf=1e17;

    struct dat
    {
        i64 x,y,pp;
    };

    struct dat2
    {
        i64 x,p;
        bool operator<(const dat2& rhs) const
        {
            return x<rhs.x;
        }
    };

    struct cht_monotone
    {
        struct line
        {
            i64 a, b;
            i64 eval(i64 x) const { return a*x+b; }
        };
        line lns[16];
        line *lp=lns,*rp=lp;
    public:
        void add(i64 a, i64 b)
        {
            while(rp>lp+1)
            {
                auto [a1,b1]=*(rp-1);
                auto [a2,b2]=*(rp-2);
                if((b-b1)*(a2-a)>(b-b2)*(a1-a)) break;
                --rp;
            }
            *rp++={a,b};
        }
        i64 get(i64 x)
        {
            assert(lp!=rp);
            while(rp>1+lp and lp->eval(x)>(lp+1)->eval(x)) lp++;
            return lp->eval(x);
        }
    };

    const int n;

    vector<i64> calc(vector<dat2> ci)
    {
        if(ci.empty()) return vector<i64>(n+1);

        sort(begin(ci), end(ci));
        const int nn=ci.size();

        i64 ps[16]={},pxs[16]={};
        for(int i=0; i<nn; i++)
        {
            ps[i]=ci[i].p;
            pxs[i]=ci[i].p*ci[i].x;
        }
        for(int i=1; i<nn; i++)
        {
            ps[i]+=ps[i-1];
            pxs[i]+=pxs[i-1];
        }

        cht_monotone cht1[16],cht2[16];
        cht1[0].add(0,0);
        cht2[0].add(0,0);
        for(int i=0; i<nn; i++)
        {
            auto [nx,np]=ci[i];
            const i64 cst1=(nx*ps[i]-pxs[i])*2;
            for(int c=0; c<=i; c++)
            {
                cht2[c+1].add(-nx, cht1[c].get(nx)+cst1);
            }
            const i64 cst2=pxs[i]*2;
            for(int c=0; c<=i+1; c++)
            {
                cht1[c].add(-ps[i], cht2[c].get(ps[i])+cst2);
            }
        }

        vector<i64> res(n+1,inf);
        for(int c=0; c<=nn; c++)
        {
            res[c]=cht2[c].get(ps[nn-1])+pxs[nn-1];
        }
        return res;
    };

    void conv(i64 (&a)[16], const vector<i64> &b)
    {
        assert((int)b.size()>n);
        for(int i=n; i>=0; i--)
        {
            a[i]+=b[0];
            for(int j=0; j<i; j++)
            {
                chle(a[i], a[j]+b[i-j]);
            }
        }
    }

    solver() : n(read())
    {
        vector<dat> cty(n);
        for(auto& [x,y,pp]: cty) cin>>x>>y>>pp;

        vector<i64> ans(n+1,inf);

        for(int s=0; s<1<<n; s++)
        {
            vector<dat2> xctp,xctn,yctp,yctn;
            for(int i=0; i<n; i++)
            {
                auto [nx,ny,np]=cty[i];
                if(s>>i&1)
                {
                    if(nx<0) xctn.push_back({-nx,np});
                    else xctp.push_back({nx, np});
                }
                else
                {
                    if(ny<0) yctn.push_back({-ny,np});
                    else yctp.push_back({ny, np});
                }
            }

            i64 res[16]={};
            conv(res, calc(xctp));
            conv(res, calc(xctn));
            conv(res, calc(yctp));
            conv(res, calc(yctn));

            for(int i=0; i<=n; i++) chle(ans[i], res[i]);
        }

        for(i64 x: ans) cout<<x<<endl;
    }
};


Measured memory_bytes: 3564