#include<cstdio>
#include<cstring>
#include<string>
#include<cstdlib>
#include<cmath>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<vector>
#include<iostream>
#include<algorithm>
#include<ctime>
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define PI acos(-1)
#define LL long long
#define inf (1<<30)
#define modn 1000000007
#define maxn 20+10
#define Mod 2
#define type 1
#define rep(a,b) for(i=a;i<=b;i++)
#define eps 1e-7
#define zero(x) fabs(x)<eps
#define equal(x,y) zero(x-y)
#define shift(x) (1<<x)
#define lowbit(x) (x&(-x))
#define del(S,i,j) (S^(1<<i)^(1<<j))
#define jiao(S,i) (S&(1<<i))
#define bing(S,i) (S|(1<<i))
#define bu(S,i) (S^(1<<i))
#define ALL_BITS (1<<n)-1
#define BuJi(A) ALL_BITS^A
#define wei_del(A,bit) (A|=(1<<bit))
#define rep_all for(s=1;s<=ALL_BITS;s++)
#define rep_zi for(s0=s;s0;s0=(s0-1)&s)
using namespace std;
vector<int> G[110];
int ans,n,m,u;
int vis[110],deg[110],val[110][110],he[110],rp[110],tmp[110];
int fun(int cur)
{
    int v,i,j;
    for(i=0;i<cur;i++)
    rp[i]=G[u][tmp[i]];
    rp[cur]=u;
    v=0;
    for(i=0;i<=cur;i++)
    {
        int t=inf;
        for(j=0;j<=cur;j++)
        {
            if(i==j)continue;
            t=min(t,val[rp[i]][rp[j]]);
        }
        v+=t;
    }
    if(v!=inf)
    ans=max(v,ans);
}
void dfs(int cur,int _n,int s)
{
    int i,j;
    fun(cur);
    for(i=s;i<_n;i++)
    {
        tmp[cur]=i;
        dfs(cur+1,_n,i+1);
    }
}
int main()
{
    int i,j;
    scanf("%d%d",&n,&m);
    memset(val,0,sizeof(val));
    for(i=1;i<=m;i++)
    {
        int x,y,z;
        scanf("%d%d%d",&x,&y,&z);
        val[x][y]=z;
        val[y][x]=z;
        G[x].push_back(y);
        G[y].push_back(x);
    }
    ans=0;
    for(i=1;i<=n;i++)
    if(G[i].size())
    {
        u=i;
        memset(vis,0,sizeof(vis));
        dfs(0,G[u].size(),0);
    }
    printf("%d\n",ans);
}