# coding: utf-8 # Your code here! n,m = [int(i) for i in input().split()] lrp = [[int(i) for i in input().split()] for _ in range(m)] g = [[1e9]*n for _ in range(n)] for l,r,p in lrp: g[l-1][r-1] = p g[r-1][l-1] = p def generator_comb(n,k): _ALL=1<> 1) | _y if _a >= _ALL: break yield _a # 下4桁;最後の位置 L = 1<<(n+4) dp = [-1]*L for i in range(n): dp[(1 << (i+4)) ^ i] = 0 for k in range(1,n): for i in generator_comb(n,k): for now in range(n): if i & (1 << now) == 0: continue ii = (i << 4)^now if dp[ii] < 0: continue for j in range(n): if i&(1 << j) != 0: continue if g[j][now] == 1e9: continue num = ((i^(1 << j))<<4)|j dp[num] = max(dp[num], dp[ii] + g[j][now]) #print([(str(bin(i>>4))[2:],i&15,d) for i,d in enumerate(dp) if d > 0 ]) print(max(dp))