#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rep1(i,n) for(int i=1;i<=(int)(n);i++)
#define all(c) c.begin(),c.end()
#define pb push_back
#define fs first
#define sc second
#define show(x) cout << #x << " = " << x << endl
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
using namespace std;
int N,M,e[100][100],deg[100];
vector<int> vs;
vector<int> vc;
int ans;
void dfs(int x,int left){
	if(left==0){
		bool can=1;
		rep(i,vc.size()) rep(j,i) if(e[vc[i]][vc[j]]==0) can=0;
		if(can){
			int sum=0;
			for(int i:vc){
				int tmp=1e9;
				for(int j:vc) if(i!=j) chmin(tmp,e[i][j]);
				sum+=tmp;
			}
			chmax(ans,sum);
		}
		return;
	}
	if(x==vs.size()) return;
	dfs(x+1,left);
	vc.pb(vs[x]);
	dfs(x+1,left-1);
	vc.pop_back();
}
int main(){
	cin>>N>>M;
	rep(i,M){
		int a,b,c;
		cin>>a>>b>>c;
		a--,b--;
		e[a][b]=e[b][a]=c;
		deg[a]++,deg[b]++;
	}
	for(int d=2;d<=14;d++){
		vs.clear();
		rep(i,N) if(deg[i]>=d-1) vs.pb(i);
		dfs(0,d);
	}
	cout<<ans<<endl;
}