#include typedef long long ll; using namespace std; int INF = 1e9; int MOD = 1e9+7; main(){ int N,M,I[2][100],S[100]; cin >> N >> M; for(int i = 0;i < M;i++)cin >> I[0][i] >> I[1][i] >> S[i]; vector v(N); iota(v.begin(),v.end(),0); int maxs = 0; do{ int score = 0; // for(auto x:v)cout << x << " ";cout << endl; for(int i = 0;i < M;i++){ if(find(v.begin(),v.end(),I[0][i]) < find(v.begin(),v.end(),I[1][i])){ score += S[i]; } } maxs = max(maxs,score); }while(next_permutation(v.begin(),v.end())); cout << maxs << endl; }