#include <bits/stdc++.h>
using namespace std;
const double eps = 1E-9;
int main(int argc, char **argv) {
  ios::sync_with_stdio(false);
  int n, k, t;
  cin >> n >> k >> t;
  vector<vector<pair<int, int>>> v(n);
  for (int i = 0; i < k; ++i) {
    int u, r, w;
    cin >> u >> r >> w;
    v[u - 1].push_back(make_pair(r - 1, w));
  }
  int ccolor = 10000;
  vector<int> used(n);
  vector<long long> ans(1, 0);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < v[i].size(); ++j) ans.push_back(v[i][j].second);
  }
  for (int i = 0; i < n - 1; ++i) {
    for (int y = 0; y < v[i].size(); ++y) {
      used[v[i][y].first] = ccolor;
      for (int j = i + 1; j < n; ++j) {
        for (int x = 0; x < v[j].size(); ++x)
          if (used[v[j][x].first] != ccolor)
            ans.push_back(v[i][y].second + v[j][x].second);
      }
      ++ccolor;
    }
  }
  int ccolor2 = -1000;
  for (int i = 0; i < n - 2; ++i) {
    for (int x = 0; x < v[i].size(); ++x) {
      used[v[i][x].first] = ccolor;
      for (int j = i + 1; j < n - 1; ++j) {
        for (int y = 0; y < v[j].size(); ++y) {
          if (used[v[j][y].first] != ccolor) {
            used[v[j][y].first] = ccolor2;
            for (int l = j + 1; l < n; ++l) {
              for (int z = 0; z < v[l].size(); ++z) {
                if (used[v[l][z].first] != ccolor &&
                    used[v[l][z].first] != ccolor2)
                  ans.push_back(v[i][x].second + v[j][y].second +
                                v[l][z].second);
              }
            }
            ++ccolor2;
          }
        }
      }
      ++ccolor;
    }
  }
  int ccolor3 = -10000;
  for (int i = 0; i < n - 3; ++i) {
    for (int x = 0; x < v[i].size(); ++x) {
      used[v[i][x].first] = ccolor;
      for (int j = i + 1; j < n - 2; ++j) {
        for (int y = 0; y < v[j].size(); ++y) {
          if (used[v[j][y].first] != ccolor) {
            used[v[j][y].first] = ccolor2;
            for (int l = j + 1; l < n - 1; ++l) {
              for (int z = 0; z < v[l].size(); ++z) {
                if (used[v[l][z].first] != ccolor &&
                    used[v[l][z].first] != ccolor2) {
                  used[v[l][z].first] = ccolor3;
                  for (int q = l + 1; q < n; ++q) {
                    for (int w = 0; w < v[q].size(); ++w) {
                      if (used[v[q][w].first] != ccolor &&
                          used[v[q][w].first] != ccolor2 &&
                          used[v[q][w].first] != ccolor3)
                        ans.push_back(v[i][x].second + v[j][y].second +
                                      v[l][z].second + v[q][w].second);
                    }
                  }
                  ++ccolor3;
                }
              }
            }
            ++ccolor2;
          }
        }
      }
      ++ccolor;
    }
  }
  int ccolor4 = -100000;
  for (int i = 0; i < n - 4; ++i) {
    for (int x = 0; x < v[i].size(); ++x) {
      used[v[i][x].first] = ccolor;
      for (int j = i + 1; j < n - 3; ++j) {
        for (int y = 0; y < v[j].size(); ++y) {
          if (used[v[j][y].first] != ccolor) {
            used[v[j][y].first] = ccolor2;
            for (int l = j + 1; l < n - 2; ++l) {
              for (int z = 0; z < v[l].size(); ++z) {
                if (used[v[l][z].first] != ccolor &&
                    used[v[l][z].first] != ccolor2) {
                  used[v[l][z].first] = ccolor3;
                  for (int q = l + 1; q < n - 1; ++q) {
                    for (int w = 0; w < v[q].size(); ++w) {
                      if (used[v[q][w].first] != ccolor &&
                          used[v[q][w].first] != ccolor2 &&
                          used[v[q][w].first] != ccolor3) {
                        used[v[q][w].first] = ccolor4;
                        for (int p = q + 1; p < n; ++p) {
                          for (int g = 0; g < v[p].size(); ++g) {
                            if (used[v[p][g].first] != ccolor &&
                                used[v[p][g].first] != ccolor2 &&
                                used[v[p][g].first] != ccolor3 &&
                                used[v[p][g].first] != ccolor4)
                              ans.push_back(v[i][x].second + v[j][y].second +
                                            v[l][z].second + v[q][w].second +
                                            v[p][g].second);
                          }
                        }
                        ++ccolor4;
                      }
                    }
                  }
                  ++ccolor3;
                }
              }
            }
            ++ccolor2;
          }
        }
      }
      ++ccolor;
    }
  }
  sort(ans.begin(), ans.end());
  cout << (t > ans.size() ? -1 : ans[t - 1]) << endl;
  return 0;
}
