#include <bits/stdc++.h>
using namespace std;
int arr[10][10];
int s[10];
set<int> ss;
vector<int> v[10];
bool F(int a, int b, int c, int d, int e) {
  s[1] = a;
  s[2] = b;
  s[3] = c;
  s[4] = d;
  s[5] = e;
  int kk = 0;
  ss.clear();
  for (int i = 1; i <= 5; i++)
    if (s[i] != 0) {
      kk++;
      ss.insert(s[i]);
    }
  return (ss.size() == kk);
  return 0;
}
int FF(int a, int b, int c, int d, int e) {
  s[1] = a;
  s[2] = b;
  s[3] = c;
  s[4] = d;
  s[5] = e;
  int ans = 0;
  for (int i = 1; i <= 5; i++)
    if (s[i] != 0) ans += arr[i][s[i]];
  return ans;
}
bool G(int a, int b, int c, int d) {
  s[1] = a;
  s[2] = b;
  s[3] = c;
  s[4] = d;
  int kk = 0;
  ss.clear();
  for (int i = 1; i <= 4; i++)
    if (s[i] != 0) {
      kk++;
      ss.insert(s[i]);
    }
  return (ss.size() == kk);
  return 0;
}
int GG(int a, int b, int c, int d) {
  s[1] = a;
  s[2] = b;
  s[3] = c;
  s[4] = d;
  int ans = 0;
  for (int i = 1; i <= 4; i++)
    if (s[i] != 0) ans += arr[i][s[i]];
  return ans;
}
bool H(int a, int b, int c) {
  s[1] = a;
  s[2] = b;
  s[3] = c;
  int kk = 0;
  ss.clear();
  for (int i = 1; i <= 3; i++)
    if (s[i] != 0) {
      kk++;
      ss.insert(s[i]);
    }
  return (ss.size() == kk);
  return 0;
}
int HH(int a, int b, int c) {
  s[1] = a;
  s[2] = b;
  s[3] = c;
  int ans = 0;
  for (int i = 1; i <= 3; i++)
    if (s[i] != 0) ans += arr[i][s[i]];
  return ans;
}
vector<int> vv;
bool D(int a, int b) {
  s[1] = a;
  s[2] = b;
  int kk = 0;
  ss.clear();
  for (int i = 1; i <= 2; i++)
    if (s[i] != 0) {
      kk++;
      ss.insert(s[i]);
    }
  return (ss.size() == kk);
  return 0;
}
int DD(int a, int b) {
  s[1] = a;
  s[2] = b;
  int ans = 0;
  for (int i = 1; i <= 2; i++)
    if (s[i] != 0) ans += arr[i][s[i]];
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  int n, k, t;
  cin >> n >> k >> t;
  for (int i = 1; i <= n; i++) v[i].push_back(0);
  for (int i = 1; i <= k; i++) {
    int a, b, h;
    cin >> a >> b >> h;
    arr[a][b] = h;
    v[a].push_back(b);
  }
  if (n == 5) {
    for (int i = 0; i < v[1].size(); i++)
      for (int j = 0; j < v[2].size(); j++)
        for (int p = 0; p < v[3].size(); p++)
          for (int q = 0; q < v[4].size(); q++)
            for (int z = 0; z < v[5].size(); z++) {
              int a = v[1][i];
              int b = v[2][j];
              int c = v[3][p];
              int d = v[4][q];
              int e = v[5][z];
              if (F(a, b, c, d, e) == true) vv.push_back(FF(a, b, c, d, e));
            }
  }
  if (n == 4) {
    for (int i = 0; i < v[1].size(); i++)
      for (int j = 0; j < v[2].size(); j++)
        for (int p = 0; p < v[3].size(); p++)
          for (int q = 0; q < v[4].size(); q++) {
            int a = v[1][i];
            int b = v[2][j];
            int c = v[3][p];
            int d = v[4][q];
            if (G(a, b, c, d) == true) vv.push_back(GG(a, b, c, d));
          }
  }
  if (n == 3) {
    for (int i = 0; i < v[1].size(); i++)
      for (int j = 0; j < v[2].size(); j++)
        for (int p = 0; p < v[3].size(); p++) {
          int a = v[1][i];
          int b = v[2][j];
          int c = v[3][p];
          if (H(a, b, c) == true) vv.push_back(HH(a, b, c));
        }
  }
  if (n == 2) {
    for (int i = 0; i < v[1].size(); i++)
      for (int j = 0; j < v[2].size(); j++) {
        int a = v[1][i];
        int b = v[2][j];
        if (D(a, b) == true) vv.push_back(DD(a, b));
      }
  }
  if (n == 1) {
    if (t == 1)
      cout << 0;
    else
      cout << arr[1][1];
  }
  sort(vv.begin(), vv.end());
  cout << vv[t - 1];
}
