import sys readline = sys.stdin.readline N,M = map(int,readline().split()) G = [{} for i in range(N)] for _ in range(M): a,b,c = map(int,readline().split()) a -= 1 b -= 1 if b in G[a]: if G[a][b] < c: G[a][b] = c G[b][a] = c else: G[a][b] = c G[b][a] = c # 一筆書きなので、端点からしか線を引けない。 # dp[v][S] = 頂点の集合がSで、現在vまで来ている dp = [[0] * (1 << N) for i in range(N)] ans = 0 for status in range(1 << N): for v in range(N): if (status >> v) & 1 == 0: continue for to_v, dist in G[v].items(): if (status >> to_v) & 1: continue next_status = status | (1 << to_v) if dp[to_v][next_status] < dp[v][status] + dist: dp[to_v][next_status] = dp[v][status] + dist if ans < dp[to_v][next_status]: ans = dp[to_v][next_status] print(ans)