#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
const int N = 21,S = 1 << 21;
typedef long long LL;
int n,m;
LL dist[N][N];
LL f[S][N];
int main(){
scanf("%d%d",&n,&m);
while(m--){
LL a,b,c;
scanf("%lld%lld%lld",&a,&b,&c);
dist[a][b] = dist[b][a] = c;
}
for(int i = 1; i < (1 << n); ++i){
for(int j = 1; j <= n; ++j){
if(!(i & (1 << (j - 1)))) continue;
for(int k = 1; k <= n; ++k){
if(i & (1 << (k - 1))) continue;
f[i | (1 << (k - 1))][k] = max(f[i | (1 << (k - 1))][k],f[i][j] + dist[j][k]);
}
}
}
LL ans = -1;
for(int i = 1; i < (1 << n); ++i){
for(int j = 1; j <= n; ++j){
if(!(i & (1 << (j - 1)))) continue;
ans = max(ans,f[i][j]);
}
}
printf("%lld",ans);
return 0;
}