#include <bits/stdc++.h>
using namespace std;
const int MN = 100 + 10;
struct block {
  int x, y, w;
  block(){};
  block(int xx, int yy, int ww) { x = xx, y = yy, w = ww; }
};
vector<block> sp;
vector<int> v;
bool bad[MN][MN];
int n, k, t;
bool can(int mask) {
  for (int i = 0; i < k; i++) {
    if (mask & (1 << i)) {
      for (int j = i + 1; j < k; j++)
        if ((mask & (1 << j)) && bad[i][j]) return false;
    }
  }
  return true;
}
int main() {
  cin >> n >> k >> t;
  for (int i = 0; i < k; i++) {
    int x, y, w;
    cin >> x >> y >> w;
    sp.push_back(block(x, y, w));
  }
  for (int i = 0; i < k; i++)
    for (int j = 0; j < k; j++)
      if (sp[i].x == sp[j].x || sp[i].y == sp[j].y) bad[i][j] = true;
  for (int mask = 0; mask < (1 << k); mask++) {
    if (can(mask)) {
      int sum = 0;
      for (int i = 0; i < k; i++)
        if (mask & (1 << i)) sum += sp[i].w;
      v.push_back(sum);
    }
  }
  sort(v.begin(), v.end());
  cout << v[t - 1] << endl;
  return 0;
}
