#ifdef ONLINE_JUDGE
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2,bmi,bmi2,lzcnt")
#endif
#include <x86intrin.h>
#include <bits/stdc++.h>
using namespace std;

struct fenwick_set {
  int n, m, sz = 0;
  vector<uint64_t> dat;
  vector<int> tree;
  fenwick_set(int _n = 0) : n(_n), m(n / 64 + 1), dat(m), tree(m + 1) {}
  int operator[](int i) const {
    return dat[i / 64] >> i % 64 & 1;
  }
  void set(int i) {
    if ((*this)[i]) return;
    ++sz;
    dat[i / 64] |= 1uLL << i % 64;
    for (int j = i / 64 + 1; j <= m; j += _blsi_u64(j)) {
      ++tree[j];
    }
  }
  void reset(int i) {
    if ((*this)[i] == 0) return;
    --sz;
    dat[i / 64] &= ~(1uLL << i % 64);
    for (int j = i / 64 + 1; j <= m; j += _blsi_u64(j)) {
      --tree[j];
    }
  }
  int rank(int i) const {
    i = clamp(i, 0, n);
    int res = _popcnt64(_bzhi_u64(dat[i / 64], i % 64));
    for (int j = i / 64; j; j = _blsr_u64(j)) {
      res += tree[j];
    }
    return res;
  }
  int select(int k) const {
    if (k < 0) return -1;
    if (k >= sz) return n;
    int j = 0;
    for (int w = 1 << __lg(m); w; w >>= 1) {
      if (j + w <= m and tree[j + w] <= k) {
        j += w;
        k -= tree[j];
      }
    }
    return j * 64 + _tzcnt_u64(_pdep_u64(1uLL << k, dat[j]));
  }
  int pred(int i) const {
    return select(rank(i) - 1);
  }
  int succ(int i) const {
    return select(rank(i + 1));
  }
};

template <class T> constexpr T inf = numeric_limits<T>::max() / 2.1;

auto chmin = [](auto&& a, auto b) { return b < a ? a = b, 1 : 0; };

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  using ll = long long;
  int n;
  cin >> n;
  vector x(2, vector<ll>(n));
  vector<ll> p(n);
  constexpr ll off = 1e4;
  for (int i = 0; i < n; ++i) {
    cin >> x[0][i] >> x[1][i] >> p[i];
    x[0][i] += off;
    x[1][i] += off;
  }
  vector pre(2, vector(n, vector(1 << n, inf<ll>)));
  for (int k : {0, 1}) {
    fenwick_set fs(2 * off + 1);
    fs.set(off);
    int bt = 0;
    auto dfs = [&](auto&& self, int nxt) -> void {
      if (nxt == n) {
        for (int i = 0; i < n; ++i) {
          if (fs[x[k][i]]) {
            pre[k][i][bt] = 0;
            continue;
          }
          ll mn = inf<ll>;
          if (int t = fs.pred(x[k][i]); t != -1) {
            chmin(mn, x[k][i] - t);
          }
          if (int t = fs.succ(x[k][i]); t != fs.n) {
            chmin(mn, t - x[k][i]);
          }
          pre[k][i][bt] = mn * p[i];
        }
        return;
      }
      self(self, nxt + 1);
      if (fs[x[k][nxt]] == 0) {
        fs.set(x[k][nxt]);
        bt |= 1 << nxt;
        self(self, nxt + 1);
        bt &= ~(1 << nxt);
        fs.reset(x[k][nxt]);
      }
    };
    dfs(dfs, 0);
  }
  vector res(n + 1, inf<ll>);
  for (int btx = 0; btx < 1 << n; ++btx) {
    if (pre[0][0][btx] == inf<ll>) continue;
    int pcx = _popcnt64(btx);
    for (int msk = _bzhi_u64(~btx, n), bty = msk; ; bty = (bty - 1) & msk) {
      if (pre[1][0][bty] == inf<ll>) continue;
      int pcy = _popcnt64(bty);
      ll cur = 0;
      for (int i = 0; i < n; ++i) {
        cur += min(pre[0][i][btx], pre[1][i][bty]);
      }
      chmin(res[pcx + pcy], cur);
      if (bty == 0) break;
    }
  }
  for (int i = 0; i < n; ++i) {
    chmin(res[i + 1], res[i]);
  }
  for (auto e : res) {
    cout << e << '\n';
  }
}


Measured memory_bytes: 15064