#include using namespace std; #define int long long int n, m; vector > graph[20]; int memo[20][100010]; int dp(int idx, int bit){ if(memo[idx][bit] != -1) return memo[idx][bit]; int ans = 0; for(int i = 0;i < graph[idx].size();i++){ int next = graph[idx][i].first; int ncost = graph[idx][i].second; if((bit & (1 << next)) == 0){ ans = max(ans, dp(next, bit | (1 << next)) + ncost); } } return memo[idx][bit] = ans; } signed main(){ cin >> n >> m; int a, b, c; for(int i = 0;i < m;i++){ cin >> a >> b >> c; a--; b--; graph[a].push_back(make_pair(b, c)); graph[b].push_back(make_pair(a, c)); } int ans = 0; memset(memo, -1, sizeof(memo)); for(int i = 0;i < n;i++){ ans = max(ans, dp(i, (1 << i))); } cout << ans << endl; return 0; }