#include <bits/stdc++.h>   using namespace std;   struct Node {     int loc;     int s;     int v;     Node(int ll, int ss, int vv) : loc(ll), s(ss), v(vv) {}     bool operator<(const Node& other) const { return v > other.v; }   };   vector<pair<int, int> > adj[32];   int main() {     priority_queue<Node> que;     int N, K, T;     scanf( %d%d%d , &N, &K, &T);     while (K--) {       int h, w, r;       scanf( %d%d%d , &h, &w, &r);       h--;       w--;       adj[h].push_back(pair<int, int>(w, r));     }     que.push(Node(0, 0, 0));     int now = 0;     while (now + 1 < T) {       Node p = que.top();       que.pop();       now++;       for (int h = p.loc; h < N; h++) {         for (int i = 0; i < adj[h].size(); i++) {           pair<int, int> w = adj[h][i];           if (!(p.s & (1 << w.first)))             que.push(Node(h + 1, p.s | (1 << w.first), p.v + w.second));         }       }     }     printf( %d n , que.top().v);     return 0;   }   