n, k, t = map(int, input().split())
p = [0] * k
for i in range(k):
    h, w, r = map(int, input().split())
    p[i] = (r, w, h)
p.sort()
q, a, b = [0], [0] * (n + 1), [0] * (n + 1) 
def f(i, s):
    global p, q, a, b, k, t
    r = [(p[j][1], p[j][2], s + p[j][0], j + 1) for j in range(i, k) if a[p[j][1]] == b[p[j][2]] == 0]
    print(r)
    q += [s[2] for s in r]
    if len(q) > t:
        q.sort()
        q = q[:t]    
    for h, w, s, j in r:
        if len(q) == t and s >= q[t - 1]: break
        a[h], b[w] = 1, 1
        f(j, s)
        a[h], b[w] = 0, 0
           
f(0, 0)
q.sort()
print(q[t - 1])