#include using namespace std; int main() { ios::sync_with_stdio(false); int N, M; cin >> N >> M; vector>> G(N); for (int i = 0; i < M; ++i) { int a, b, c; cin >> a >> b >> c; G[a - 1].emplace_back(c, b - 1); G[b - 1].emplace_back(c, a - 1); } vector> dp(1 << N, vector(N)); for (int s = 0; s < 1 << N; ++s) { for (int x = 0; x < N; ++x) { if (~s >> x & 1) continue; for (auto e : G[x]) { int w, y; tie(w, y) = e; if (s >> y & 1) continue; dp[s | 1 << y][y] = max(dp[s | 1 << y][y], dp[s][x] + w); } } } int ans = 0; for (int s = 0; s < 1 << N; ++s) { for (int i = 0; i < N; ++i) { ans = max(ans, dp[s][i]); } } cout << ans << endl; return 0; }