#include <bits/stdc++.h>
using namespace std;
const int nmax = 10;
bool usedh[nmax], usedw[nmax];
vector<int> V;
struct vl {
  int h, w, r;
} G[nmax * nmax];
int main() {
  int x, y, n, k, t, i, j, p, r, g;
  cin >> n >> k >> t;
  for (i = 1; i <= k; i++) {
    cin >> G[i].h >> G[i].w >> G[i].r;
  }
  int mask1, mask2, mask3, mask4, mask5;
  for (i = 0; i <= k; i++) {
    if (i == 0)
      mask1 = 0;
    else
      mask1 = (1 << (n + G[i].h + 1)) + (1 << G[i].w);
    for (j = i; j <= k; j++) {
      if (j == 0)
        mask2 = 0;
      else
        mask2 = (1 << (n + G[j].h + 1)) + (1 << G[j].w);
      if ((mask1 & mask2) != 0) continue;
      for (p = j; p <= k; p++) {
        if (p == 0)
          mask3 = 0;
        else
          mask3 = (1 << (n + G[p].h + 1)) + (1 << G[p].w);
        if ((mask1 & mask3) != 0 || (mask2 & mask3) != 0) continue;
        for (r = p; r <= k; r++) {
          if (r == 0)
            mask4 = 0;
          else
            mask4 = (1 << (n + G[r].h + 1)) + (1 << G[r].w);
          if ((mask1 & mask4) != 0 || (mask2 & mask4) != 0 ||
              (mask3 & mask4) != 0)
            continue;
          for (g = r; g <= k; g++) {
            if (g == 0)
              mask5 = 0;
            else
              mask5 = (1 << (n + G[g].h + 1)) + (1 << G[g].w);
            if ((mask1 & mask5) != 0 || (mask2 & mask5) != 0 ||
                (mask3 & mask5) != 0 || (mask5 & mask4) != 0)
              continue;
            int cur = 0;
            if (mask1) cur += G[i].r;
            if (mask2) cur += G[g].r;
            if (mask3) cur += G[p].r;
            if (mask4) cur += G[r].r;
            if (mask5) cur += G[g].r;
            V.push_back(cur);
          }
        }
      }
    }
  }
  sort(V.begin(), V.end());
  cout << V[t - 1];
}
