#include using namespace std; using ll = long long; using P = pair; using T = tuple; ll dp[16][16][1 << 16]; //bool memo[16][16][1 << 16]; vector

g[16]; void dfs(int src, ll& ans) { priority_queue pq; pq.emplace(0, src, 1 << src); dp[src][src][1 << src] = -1; while (!pq.empty()) { ll c, cur, used; tie(c, cur, used) = pq.top(); pq.pop(); //if (dp[src][cur][used] >= c) continue; dp[src][cur][used] = c; for (P& p : g[cur]) { if (used & (1 << p.first)) continue; int n_used = (used | (1 << p.first)); ll& tar = dp[src][p.first][n_used]; ll cost = dp[src][cur][used] + p.second; if (tar < cost) { tar = cost; ans = max(ans, tar); pq.emplace(cost, p.first, n_used); } } } } int main() { cin.tie(0); ios::sync_with_stdio(false); int n, m; cin >> n >> m; for (int i = 0; i < m; i++) { int a, b; ll c; cin >> a >> b >> c; a--; b--; g[a].emplace_back(b, c); g[b].emplace_back(a, c); } ll ans = 0; for (int i = 0; i < n; i++) { dfs(i, ans); } cout << ans << endl; return 0; }