#include <bits/stdc++.h>
using namespace std;
int e[20][20];
int vis[100];
int n, k, t, cnt;
priority_queue<int, vector<int>, greater<int> > q;
void dfs(int pos, int sum) {
  if (pos > n) {
    q.push(sum);
    return;
  }
  dfs(pos + 1, sum);
  for (int i = 1; i <= n; i++) {
    if (!vis[i] && e[pos][i]) {
      vis[i] = 1;
      dfs(pos + 1, sum + e[pos][i]);
      vis[i] = 0;
    }
  }
}
int main() {
  int x, y, z;
  scanf("%d %d %d", &n, &k, &t);
  for (int i = 1; i <= k; i++) {
    scanf("%d %d %d", &x, &y, &z);
    e[x][y] = z;
  }
  dfs(1, 0);
  while (--k) {
    q.pop();
  }
  printf("%d\n", q.top());
  return 0;
}
