#include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

const long long MAX = 5100000;
const long long INF = 1LL << 60;
const long long mod = 1000000007LL;
//const long long mod = 998244353LL;

using namespace std;
typedef unsigned long long ull;
typedef long long ll;

ll N, M;
vector<vector<ll>> g;
vector<vector<ll>> dp;
ll dfs(ll S, ll pre) {
	if (S == (1 << N) - 1) return 0;
	if (pre != -1 && dp[S][pre] != -1) return dp[S][pre];
	ll res = 0;
	if (pre == -1) {
		for (ll i = 0; i < N; i++) chmax(res, dfs(1 << i, i));
		return res;
	}
	else {
		for (ll i = 0; i < N; i++) {
			if (!(S >> i & 1) && g[pre][i]) chmax(res, dfs(S + (1 << i), i) + g[pre][i]);
		}
		return dp[S][pre] = res;
	}
}
int main()
{
	/*
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	*/
	scanf("%lld %lld", &N, &M);
	g = vector<vector<ll>>(N, vector<ll>(N));
	dp = vector<vector<ll>>(1 << N, vector<ll>(N, -1));
	for (ll i = 0; i < M; i++) {
		ll a, b, c; scanf("%lld %lld %lld", &a, &b, &c);
		a--; b--;
		chmax(g[a][b], c);
		chmax(g[b][a], c);
	}

	cout << dfs(0, -1) << endl;
	return 0;
}