#include <bits/stdc++.h>   using namespace std;   struct node {     int h, w, r;   } edge[110];   bool vis[11];   int x[5000000];   int n, k, t;   void init() {     cin >> n >> k >> t;     for (int i = 1; i <= k; i++) cin >> edge[i].h >> edge[i].w >> edge[i].r;   }   void solve() {     int l = 0;     for (int j = 1; j <= (1 << k) - 1; j++) {       int t = 0;       for (int i = 1; i <= k; i++)         if ((j & (1 << (i - 1))) != 0) t++;       if (t > n) continue;       memset(vis, 0, sizeof(vis));       int s = 0;       bool flag = true;       for (int i = 1; i <= k; i++)         if ((j & (1 << (i - 1))) != 0) {           if (vis[edge[i].h] || vis[edge[i].w + n]) {             flag = false;             break;           }           vis[edge[i].h] = vis[edge[i].w + n] = true;           s += edge[i].r;         }       if (flag) x[++l] = s;     }     sort(x, x + l + 1);     cout << x[t - 1] << endl;   }   int main() {     ios::sync_with_stdio(false);     init();     solve();     return 0;   }   