#include <bits/stdc++.h>
using namespace std;
const long INF = (long)1e09;
struct node {
  int h, w, r;
};
int n, m, j, k, ans = 0, c, t, z, next = 0;
vector<int> all, a(30, 0);
set<int> hus, wiw;
vector<node> d;
bool comp(node a, node b) { return a.r > b.r; }
int main() {
  scanf("%d %d %d", &n, &k, &t);
  node l;
  l.h = 0;
  l.w = 0;
  l.r = 0;
  d.push_back(l);
  for (long i = 1; i <= k; i++) {
    int x, y, z;
    scanf("%d %d %d", &x, &y, &z);
    node l;
    l.h = x;
    l.w = y;
    l.r = z;
    d.push_back(l);
  }
  sort(d.begin() + 1, d.end(), comp);
  while (true) {
    hus.clear();
    wiw.clear();
    long res = 0;
    bool f = 1;
    for (long i = 1; i <= k; i++)
      if (a[i] > 0) {
        if (hus.count(d[i].h) || wiw.count(d[i].w)) {
          f = 0;
          break;
        }
        hus.insert(d[i].h);
        wiw.insert(d[i].w);
        res += d[i].r;
      }
    if (f) all.push_back(res);
    if (all.size() > t * 2) {
      sort(all.begin(), all.end());
      printf("%d", all[t - 1]);
      return 0;
    }
    a[k]++;
    z = k;
    while (z > 0) {
      if (a[z] > 1) {
        a[z - 1]++;
        a[z] = 0;
      }
      z--;
    }
    if (a[0]) break;
  }
  sort(all.begin(), all.end());
  printf("%d", all[t - 1]);
  return 0;
}
