#include using namespace std; int main() { int N, M; cin >> N >> M; vector> dist(N, vector(N, -1 << 30)); for (int i = 0; i < M; i++) { int a, b, c; cin >> a >> b >> c; a--; b--; dist[a][b] = dist[b][a] = c; } vector> dp(1 << N, vector(N, -1LL << 60)); 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 ((i >> j) & 1 == 0) continue; int l = i ^ (1 << j); for (int k = 0; k < N; k++) { if ((l >> k) & 1 == 0) continue; dp[i][j] = max(dp[i][j], dp[l][k] + dist[k][j]); } } } long long ans = 0; for (int i = 0; i < (1 << N); i++) { for (int j = 0; j < N; j++) { ans = max(ans, dp[i][j]); } } cout << ans << endl; }