#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <set>
using namespace std;

struct node
{
    long long a,b;
    friend bool operator < (const node& a,const node& b)
    {
        if (a.a == b.a) return a.b < b.b;
        return a.a < b.a;
    }
    void set(int pos)
    {
        if (pos < 64)
            a |= 1LL<<pos;
        else
            b |= 1LL<<(pos-64);
    }
    int get(int pos)
    {
        if (pos < 64)
            return ((a>>pos)&1);
        else
            return ((b>>(pos-64))&1);
    }
};

int n,m,res;
int g[100][100];
set<node> flag;

void Gao(int tot,node used,int last)
{
    if (tot > 1)
    {
        int sum = 0,tsum;
        for (int i = 0; i <= last; i++)
            if (used.get(i) == 1)
            {
                tsum = 19921005;
                for (int j = 0; j <= last; j++)
                    if (i != j && used.get(j) == 1)
                        tsum = min(tsum,g[i][j]);
                sum += tsum;
            }
        res = max(res,sum);
    }
    node tmp;
    bool check;
    for (int i = last+1; i < n; i++)
    {
        check = true;
        for (int j = 0; j <= last; j++)
            if (used.get(j) == 1 && g[j][i] == 0)
            {
                check = false;
                break;
            }
        if (check == true)
        {
            tmp = used;
            tmp.set(i);
            Gao(tot+1,tmp,i);
        }
    }
}

int main()
{
    while (scanf("%d%d",&n,&m) != EOF)
    {
        memset(g,0,sizeof(g));
        for (int i = 0; i < m; i++)
        {
            int u,v,f;
            scanf("%d%d%d",&u,&v,&f);
            u--;
            v--;
            g[u][v] = max(g[u][v],f);
            g[v][u] = max(g[v][u],f);
        }
        res = 0;
        flag.clear();
        node tmp;
        tmp.a = tmp.b = 0;
        Gao(0,tmp,-1);
        printf("%d\n",res);
    }
    return 0;
}