N,M = map(int,input().split()) G = [[] for i in range(N)] for _ in range(M): a,b,c = map(int,input().split()) G[a - 1].append([b - 1, c]) G[b - 1].append([a - 1, c]) dp = [[-1] * N for i in range(1 << N)] for i in range(N): dp[1 << i][i] = 0 for i in range(1 << N): for v in range(N): if (i >> v) & 1 == 0: continue for u, c in G[v]: if (i >> u) & 1: continue dp[i | (1 << u)][u] = max(dp[i | (1 << u)][u], dp[i][v] + c) ans = 0 for i in range(1 << N): ans = max(ans, max(dp[i])) print(ans)