#include <algorithm>
#include <cassert>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

#include <limits.h>

using namespace std;

typedef long long ll;

template<class T>
inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

template<class T>
inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

const ll INF = LONG_LONG_MAX / 2;

vector<int> xs;
vector<int> ys;
vector<int> ps;

// Calculate score for chosen lines.
ll calc(vector<int> &lxs, vector<int> &lys, const int num_line, const int num_city) {
    ll ans = 0;
    // sort(lxs.begin(), lxs.end());
    // sort(lys.begin(), lys.end());

#ifdef DEBUG
    printf("lxs: ");
    for (auto x : lxs) {
        cout << x << " ";
    }
    cout << endl;
    printf("lys: ");
    for (auto y : lys) {
        cout << y << " ";
    }
    cout << endl;
#endif

    for (int i = 0; i < num_city; i++) {
        ll dist = INF;
        for (auto lx : lxs) {
            chmin(dist, ll(abs(xs[i] - lx)) * ps[i]);
        }
        for (auto ly : lys) {
            chmin(dist, ll(abs(ys[i] - ly)) * ps[i]);
        }
        ans += dist;
    }

#ifdef DEBUG
    cout << "ans: " << ans << endl;
#endif
    return ans;
}

// Choose lines.
// xs contains line parallel to x axis.
// ys contains line parallel to y axis.
ll h(int pos, vector<int> &lxs, vector<int> &lys, const int num_line, const int num_city, const vector<int> &acc_city) {
    if (pos >= num_line) {
        return calc(lxs, lys, num_line, num_city);
    }

    ll cand = INF;
    const int cur_city = acc_city[pos];
    lxs.push_back(xs[cur_city]);
    chmin(cand, h(pos + 1, lxs, lys, num_line, num_city, acc_city));
    lxs.pop_back();
    lys.push_back(ys[cur_city]);
    chmin(cand, h(pos + 1, lxs, lys, num_line, num_city, acc_city));
    lys.pop_back();

    return cand;
}

// Calculate the best score for chosen cities.
// Each city has at least one line.
ll g(const int num_line, const int num_city, const vector<int> &acc_city) {
#ifdef DEBUG
    for (auto city : acc_city) {
        cout << city << " ";
    }
    cout << endl;
#endif

    vector<int> lxs;
    lxs.push_back(0);
    vector<int> lys;
    lys.push_back(0);

    return h(0, lxs, lys, num_line, num_city, acc_city);
}

// Choose cities
ll f(int cur, const int num_line, const int num_city, vector<int> &acc_city) {
    if ((int) acc_city.size() == num_line) {
        return g(num_line, num_city, acc_city);
    }
    if (cur >= num_city) {
        return INF;
    }

    ll cand = INF;

    acc_city.push_back(cur);
    chmin(cand, f(cur + 1, num_line, num_city, acc_city));
    acc_city.pop_back();
    chmin(cand, f(cur + 1, num_line, num_city, acc_city));

    return cand;
}

int main(void) {
    int N;
    cin >> N;

    xs.resize(N);
    ys.resize(N);
    ps.resize(N);
    for (int i = 0; i < N; i++) {
        int X, Y, P;
        cin >> X >> Y >> P;
        xs[i] = X;
        ys[i] = Y;
        ps[i] = P;
    }

    for (int k = 0; k <= N; k++) {
        // printf("k: %d\n", k);
        vector<int> acc_city;
        cout << f(0, k, N, acc_city) << endl;
    }

    return 0;
}


Measured memory_bytes: 3632