#include <bits/stdc++.h>
using namespace std;
struct T {
  int a, b, c;
  bool operator<(const T& f) const { return c < f.c; }
} A[1111];
int m[6], w[6];
int main() {
  int n, k, t, i;
  for (scanf("%d %d %d", &n, &k, &t), i = 0; i < k;
       scanf("%d %d %d", &A[i].a, &A[i].b, &A[i].c), i++)
    ;
  sort(A, A + n);
  vector<int> res;
  int mask, h = (1 << k);
  int cnt = 0;
  for (mask = 0; mask < h; mask++) {
    memset(m, 0, sizeof(m));
    memset(w, 0, sizeof(w));
    int sum = 0;
    for (i = 0; i < k; i++)
      if (mask & (1 << i)) m[A[i].a]++, w[A[i].b]++, sum += A[i].c;
    for (i = 0; i < n; i++)
      if (m[A[i].a] > 1 || w[A[i].b] > 1) goto F;
    cnt++;
    if (cnt == t) {
      printf("%d\n", sum);
      return 0;
    }
  F:;
  }
  puts("0");
  return 0;
}
