#include<bits/stdc++.h>
#define S second
#define INF (1e9)
#define N 105
using namespace std;

typedef pair<int,int> P;

int n, m, d[N][N];
int used[N], ans=0;

vector<P> idx;

set<vector<int> > memo;

void dfs(int x,vector<int> G){
  
  if(x>=2){

    int sum=0;

    for(int i=0;i<G.size();i++){
      
      int mincost=INF;
      
      for(int j=0;j<G.size();j++){
      
	if(G[i]!=G[j])
	  mincost=min(mincost,d[G[i]][G[j]]);
      
      }

      if(mincost!=INF) sum+=mincost;
    
    }
  
    ans=max(ans,sum);

  }
  
  sort(G.begin(),G.end());
  
  if(memo.count(G)) return ;
  memo.insert(G);
  
  for(int i=0;i<n;i++){

    if(used[idx[i].S]) continue;

    used[idx[i].S]=1;
    
    int mincost=INF;

    vector<int> nG=G;

    nG.push_back(idx[i].S);
    
    for(int j=0;j<nG.size();j++)
      
      if(idx[i].S!=nG[j]&&used[nG[j]])
	mincost=min(mincost,d[idx[i].S][nG[j]]);
    
    if(!x||(mincost&&mincost!=INF)) dfs(x+1,nG);
    
    used[idx[i].S]=0;
    
  }
  
}

int main(){
  
  cin>>n>>m;

  int a, b , f;

  for(int i=0;i<n;i++) idx.push_back(P(0,i));
  
  for(int i=0;i<m;i++){
    
    cin>>a>>b>>f;
    
    d[a-1][b-1]=d[b-1][a-1]=f;
    
    idx[a-1].first++;
    idx[b-1].first++;
  }

  sort(idx.begin(),idx.end());
  
  vector<int> init;
  
  dfs(0,init);

  cout<<ans<<endl;
  
  return 0;
}