#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:256000000")
using namespace std;
template <class T>
double sqrt(T x) {
  return sqrt((double)x);
}
template <class T>
T sqr(T x) {
  return x * x;
}
const double PI = acos(-1.0);
const int INF = 1000000000;
const int MOD = 1000000007;
int main() {
  double TIME_START = clock();
  int n, k, t;
  cin >> n >> k >> t;
  vector<int> v(k + 1), h(k + 1), r(k + 1);
  for (int x = 1; x <= k; x++) {
    cin >> v[x] >> h[x] >> r[x];
  }
  bool min[50] =
      {
          0,
      },
       win[50] = {
           0,
       };
  vector<int> ans(t);
  ans[0] = 0;
  int tr = 1;
  int pe[30] = {
      0,
  };
  for (int x = 1; x <= k; x++) {
    for (int y = 0; y < x; y++) pe[y] = x - y;
    pe[0]--;
    while (pe[0] <= k && pe[x] == 0) {
      int i = 0;
      while (pe[i] == k) {
        i++;
      }
      pe[i]++;
      if (pe[x] != 0) break;
      for (; i > 0; i--) pe[i - 1] = pe[i] + 1;
      if (pe[0] >= k + 1) break;
      int cp = 0,
          w[25] =
              {
                  0,
              },
          m[25] = {
              0,
          };
      for (int y = 0; y < x; y++) {
        cp += r[pe[y]];
        if (w[h[pe[y]]] || m[v[pe[y]]]) goto end;
        w[h[pe[y]]] = 1;
        m[v[pe[y]]] = 1;
      }
      ans[tr++] = cp;
      if (tr == t) goto out;
    end:;
    }
  }
out:;
  sort(ans.begin(), ans.end());
  cout << ans[t - 1];
  fprintf(stderr, "\n\n%.15lf\n\n",
          (double)(clock() - TIME_START) / CLOCKS_PER_SEC);
  return 0;
}
