#include using namespace std; #define INF 1000000007 #define LINF 1000000000000000007 typedef long long i64; typedef pair P; int n, m; vector

v[20]; bool used[20]; i64 dp[(1 << 17)][17]; i64 dfs(int now, i64 score, int was){ if(dp[was][now] != 0) return dp[was][now]; for(int i = 0; i < v[now].size(); i++){ if(used[v[now][i].first]) continue; used[now] = 1; dp[was][now] = max(dp[was][now], dfs(v[now][i].first, score, was + (1 << v[now][i].first)) + v[now][i].second); used[v[now][i].first] = 0; } return dp[was][now]; } int main(){ cin >> n >> m; for(int i = 0; i < m; i++){ i64 a,b,c; cin >> a >> b >> c; v[a].push_back(P(b,c)); v[b].push_back(P(a,c)); } for(int i = 0; i < n; i++){ sort(v[i].begin(), v[i].end(), greater

()); } i64 ans = 0; for(int i = 1; i <= n; i++){ for(int j = 0; j < (1 << 17); j++) for(int k = 0; k < 17; k++){ dp[j][k] = 0; } used[i] = 1; ans = max(ans, dfs(i, 0, (1 << i))); used[i] = 0; } cout << ans << endl; return 0; }