#include <bits/stdc++.h>
using namespace std;
int n, m, t;
pair<int, pair<int, int> > p[111];
struct data {
  int seq[20], tot;
  data() { tot = 0; }
  void add(int v) { seq[tot++] = v; }
  void change(int v) {
    assert(tot > 0);
    seq[tot - 1] = v;
  }
};
bool markx[22], marky[22];
queue<data> qs[2111];
int main() {
  scanf("%d%d%d", &n, &m, &t);
  for (int i = 1, u, v, w; i <= m; i++) {
    scanf("%d%d%d", &u, &v, &w);
    p[i] = make_pair(w, make_pair(u, v));
  }
  sort(p + 1, p + m + 1);
  qs[0].push(data());
  int cur = 0;
  while (--t) {
    while (qs[cur].empty()) cur++;
    data v = qs[cur].front();
    qs[cur].pop();
    memset(markx, 0, sizeof(markx));
    memset(marky, 0, sizeof(marky));
    int id = 0;
    for (int i = 0; i < v.tot; i++) {
      id = v.seq[i];
      markx[p[id].second.first] = marky[p[id].second.second] = 1;
    }
    for (int i = id + 1; i <= m; i++)
      if (!markx[p[i].second.first] && !marky[p[i].second.second]) {
        data nv = v;
        nv.add(i);
        qs[cur + p[i].first].push(nv);
        break;
      }
    if (id) {
      markx[p[id].second.first] = marky[p[id].second.second] = 0;
      for (int i = id + 1; i <= m; i++)
        if (!markx[p[i].second.first] && !marky[p[i].second.second]) {
          data nv = v;
          nv.change(i);
          qs[cur - p[id].first + p[i].first].push(nv);
          break;
        }
    }
  }
  while (qs[cur].empty()) cur++;
  printf("%d\n", cur);
  return 0;
}
