#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using uint = unsigned int;
using rl = double;
using ull = unsigned long long;
const int MAXV = 100 * 1000;
int tcnt[MAXV + 1];
map<ull, int> wcnt[MAXV + 1];
int main() {
  int n, k, t;
  scanf("%d %d %d", &n, &k, &t);
  wcnt[0][0] = 1;
  tcnt[0] = 1;
  for (int z = 1; z <= k; z++) {
    int h, w, r;
    scanf("%d %d %d", &h, &w, &r);
    h--, w--;
    ull nmask = (1 << h) | (1 << (w + n));
    int from = MAXV;
    int tt = 0;
    for (int i = 0; i <= MAXV; i++) {
      tt += tcnt[i];
      if (tt >= t) {
        from = i - 1;
        break;
      }
    }
    for (int i = from - r; i >= 0; i--) {
      for (auto& v : wcnt[i]) {
        if (v.first & nmask) continue;
        wcnt[i + r][v.first | nmask] += v.second;
        tcnt[i + r] += v.second;
      }
    }
  }
  int answ = 0;
  while (true) {
    t -= tcnt[answ];
    if (t <= 0) break;
    answ++;
  }
  printf("%d\n", answ);
}
