#include int ri() { int n; scanf("%d", &n); return n; } int main() { int n = ri(), m = ri(); int a[m], b[m], c[m]; for (int i = 0; i < m; i++) a[i] = ri() - 1, b[i] = ri() - 1, c[i] = ri(); std::map hens[n]; for (int i = 0; i < m; i++) { if (hens[a[i]].count(b[i])) hens[a[i]][b[i]] = std::max(hens[a[i]][b[i]], c[i]); else hens[a[i]][b[i]] = c[i]; if (hens[b[i]].count(a[i])) hens[b[i]][a[i]] = std::max(hens[b[i]][a[i]], c[i]); else hens[b[i]][a[i]] = c[i]; } int dp[1 << n][n]; for (int i = 0; i < 1 << n; i++) for (int j = 0; j < n; j++) dp[i][j] = -1; for (int i = 0; i < n; i++) dp[1 << i][i] = 0; for (int i = 0; i < 1 << n; i++) { for (int j = 0; j < n; j++) { if (dp[i][j] < 0) continue; for (auto &k : hens[j]) { if (i >> k.first & 1) continue; dp[i | 1 << k.first][k.first] = std::max(dp[i | 1 << k.first][k.first], dp[i][j] + k.second); } } } int res = 0; for (int i = 0; i < 1 << n; i++) for (int j = 0; j < n; j++) res = std::max(res, dp[i][j]); std::cout << res << std::endl; return 0; }