#include <bits/stdc++.h>
using namespace std;
int n, k, t;
int a[100][100];
set<pair<int, int> > h;
bool used[100];
void solve(int m, int res, int mask) {
  if (m == n + 1) {
    h.insert(make_pair(res, mask));
    return;
  }
  solve(m + 1, res, mask * 10);
  for (int i = 1; i <= n; i++)
    if (!used[i]) {
      used[i] = true;
      solve(m + 1, res + a[m][i], mask * 10 + i);
      used[i] = false;
    }
}
int main() {
  cin >> n >> k >> t;
  for (int i = 0; i < k; i++) {
    int m, w, r;
    cin >> m >> w >> r;
    a[m][w] = r;
  }
  solve(1, 0, 0);
  set<pair<int, int> >::iterator i = h.begin();
  t--;
  while (t--) i++;
  cout << i->first;
  return 0;
}
