#include <iostream>
#include <vector>
#include <queue>
#include <cstdio>
#include <cstdio>
#include <stack>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <ctime>
#include <math.h>
#include <cassert>

#define forn(i, n) for(int i=0;i<n;++i)
#define for1(i, n) for(int i=1;i<=n;++i)
#define forv(i, v) for(int i=0;i<v.size();++i)
#define sz(v) v.size()
#define all(v) v.begin(), v.end()
#define pb push_back
#define mp make_pair
#define ld double 
#define li long long
#define X first
#define Y second
#define P (259)
    
using namespace std;

typedef pair <ld, ld> pt;
const li N = 105, M = 502,  INF = 1000*1000*1000 + 7;
const ld  eps = 1e-9;
const ld pi = 3.1415926535897932384626433832795;

struct node {
    int from;
    int to;
    int l;
};
bool operator <(node &a, node &b) {
    return a.l < b.l;   
}

int p[N][N];
vector<node> a;

int main()
{   
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    
    int n,k,t; 
    cin >> n >> k >> t;
    a.resize(k);
    forn(i, k) {
        int t, b, l;
        cin >> t >> b >> l;
        node tmp;
        tmp.from = t;
        tmp.to = b;
        tmp.l = l;
        a[i] = tmp;
    }
    sort(all(a));
    t--;
    if (!t) {
        cout << 0;
        return 0;
    }
    set<pair<int, pair<set<int>, set<int>>>> kit;
    forn(i, k) {
        set<int> k1;
        set<int> k2;
        k1.insert(a[i].from);
        k2.insert(a[i].to);
        kit.insert(mp(a[i].l, mp(k1, k2)));
    }
    forn(j, k) {
        set<pair<int, pair<set<int>, set<int>>>> tmp;
        for(set<pair<int, pair<set<int>, set<int>>>>::iterator i = kit.begin(); i != kit.end(); i++) {
            set<int> k1 = i->second.first;
            set<int> k2 = i->second.second;
            if (k1.count(a[j].from) || k2.count(a[j].to))
                continue;
            k1.insert(a[j].from);
            k2.insert(a[j].to);
            tmp.insert(mp(a[j].l + i->first, mp(k1, k2)));
        }
        for(set<pair<int, pair<set<int>, set<int>>>>::iterator i = tmp.begin(); i != tmp.end(); i++)
            kit.insert(*i);
    }
    int j=t;
    for(set<pair<int, pair<set<int>, set<int>>>>::iterator i = kit.begin(); i != kit.end(); i++) {
        j--;
        if (j == 0) {
            cout << i->first;
            return 0;
        }
    }

    return 0;
}
