#include<bits/stdc++.h>

using namespace std;


struct CWW{CWW(){ios::sync_with_stdio(false);cin.tie(0);}}cww;

typedef __int128 Int;
typedef long long LL;
typedef vector<int> V;
typedef vector<LL> VL;
typedef vector<Int> VI;
map<Int,int> pos;
map<Int,LL> memo;
Int allbit;
LL sum(VL &v){
    LL res=0;
    for(auto &it:v)res+=it;
    return res;
}
template<typename T>
ostream& operator<<(ostream& os,vector<T> v){
    for(auto &it:v)os<<it<<" ";
    return os;
}
void dfs(Int used,VI& exists,V &vv,VL val,vector<VL>& edge){
    Int rest=allbit&(~used);
    for(auto &it:vv)rest&=exists[it];
    //cout<<vv<<endl;
    while(rest){
	Int nowbit=rest&(-rest);
	rest-=nowbit;
	if(memo.count(nowbit|used))continue;
	int nowpos=pos[nowbit];
	auto nxtval=val;
	nxtval[nowpos]=1145141919;
	for(auto &it:vv){
	    nxtval[it]=min(nxtval[it],edge[it][nowpos]);
	    nxtval[nowpos]=min(nxtval[nowpos],edge[it][nowpos]);
	}
	memo[nowbit|used]=sum(nxtval);
	vv.push_back(nowpos);
	dfs(used|nowbit,exists,vv,nxtval,edge);
	vv.pop_back();
    }
}

int main(){
    int N,M;
    cin>>N>>M;
    VI exists(N,0);
    vector<VL> edge(N,VL(N,0));
    Int bit=1;
    for(Int i=0;i<N;i++,bit<<=1){
	pos[bit]=i;
    }
    allbit=bit-1;
    while(M--){
	int a,b,c;
	cin>>a>>b>>c;
	a--,b--;
	edge[a][b]=c;
	edge[b][a]=c;
	exists[a]|=((Int)1)<<b;
	exists[b]|=((Int)1)<<a;
    }
    for(int i=0;i<N;i++){
	vector<int> vv(1,i);
	VL val(N,0);
	val[i]=1145141919;
	dfs(((Int)1)<<i,exists,vv,val,edge);
    }
    LL res=0;
    for(auto &it:memo)res=max(res,it.second);
    cout<<res<<endl;
    return 0;
}