#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (k); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
#define D10 fixed<<setprecision(10)
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<string> vs;
typedef pair<int, int> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

int main()
{
	int n, m;
	cin >> n >> m;
	vector<vi> mat(n, vi(n));
	REP(i, m)
	{
		int a, b, c; cin >> a >> b >> c;
		a--; b--;
		mat[a][b] = mat[b][a] = c;
	}
	set<set<int>> st;
	queue<set<int>> que;
	REP(i, n)
	{
		set<int> t = { i };
		st.insert(t);
		que.push(t);
	}
	while (que.size())
	{
		set<int> tmp = que.front();
		que.pop();
		REP(i, n)
		{
			if (tmp.count(i)) continue;
			set<int> nx = tmp;
			nx.insert(i);
			if (st.count(nx)) continue;
			bool f = true;
			for (auto j : tmp)
			{
				if (mat[i][j] == 0)
				{
					f = false; break;
				}
			}
			if (f)
			{
				que.push(nx);
				st.insert(nx);
			}
		}
	}
	int ans = 0;
	for (auto i : st)
	{
		if (i.size() == 1) continue;
		int tmp = 0;
		for (auto j : i)
		{
			int res = INF;
			for (auto k : i)
			{
				if (j == k) continue;
				else chmin(res, mat[j][k]);
			}
			tmp += res;
		}
		chmax(ans, tmp);
	}
	cout << ans << endl;
	return 0;
}