#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

ll a[111][111];
ll ans;
int n;

void dfs(vector<int>& v){
    int m=v.size();
    ll ret=0;
    rep(i,m){
        ll res=inf;
        rep(j,m){
            if(i==j)continue;
            res=min(res,a[v[i]][v[j]]);
        }
        ret+=res;
    }
    if(m==1)ret=0;
    ans=max(ans,ret);
    REP(i,v[m-1]+1,n){
        bool ok=true;
        rep(j,m)if(a[v[j]][i]==0)ok=false;
        if(!ok)continue;
        v.push_back(i);
        dfs(v);
        v.pop_back();
    }
}
int main(){
    cin>>n;
    int m;
    cin>>m;
    rep(i,m){
        int x,y,z;
        cin>>x>>y>>z;
        --x;--y;
        a[x][y]=a[y][x]=z;
    }
    rep(i,n){
        vector<int> v(1,i);
        dfs(v);
    }
    cout<<ans<<endl;
    return 0;
}
