#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 dfs(int now, i64 score){ i64 ret = score; for(int i = 0; i < v[now].size(); i++){ if(used[v[now][i].first]) continue; used[now] = 1; ret = max(ret, dfs(v[now][i].first, score) + v[now][i].second); used[v[now][i].first] = 0; } return ret; } 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++){ used[i] = 1; ans = max(ans, dfs(i, 0)); used[i] = 0; } cout << ans << endl; return 0; }