N, M = map(int,input().split()) G = [[] for i in range(N)] for i in range(M): A, B, C = map(int,input().split()) A, B = A - 1, B - 1 G[A].append((B, C)) G[B].append((A, C)) N2 = 1 << N inf = 10 ** 18 dp = [[-inf] * N for i in range(N2)] for i in range(N): dp[1 << i][i] = 0 for s in range(1, N2): for i in range(N): if not (s >> i) & 1: continue for u, C in G[i]: if (s >> u) & 1: continue dp[s | (1 << u)][u] = max(dp[s | (1 << u)][u], dp[s][i] + C) ans = 0 for i in range(N2): ans = max(ans, max(dp[i])) print(ans)