#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,P> PP;
const long long int MOD = 1000000007;
const int INF = 1000000000;

int n, m;
set<vector<int> > ho, ge;
set<vector<int> >::iterator it;
int ans = 0;
bool saw[100];
int ed[100][100];

int main(){
    cin >> n >> m;
    rep(i,m){
        int f, t, c;
        cin >> f >> t >> c;
        f--; t--;
        if(f > t) swap(f,t);
        ed[f][t] = c; ed[t][f] = c;
        vector<int> tmp;
        tmp.push_back(f); tmp.push_back(t);
        ho.insert(tmp);
        ans = max(ans,c*2);
    }
    while(true){
        ge.clear();
        for(it = ho.begin(); it != ho.end(); it++){
            vector<int> tmp = (*it);
            memset(saw,0,sizeof(saw));
            rep(i,tmp.size()) saw[tmp[i]] = true;
            rep(i,n){
                if(saw[i]) continue;
                bool ok = true;
                rep(j,tmp.size()){
                    if(ed[i][tmp[j]] == 0){
                        ok = false;
                        break;
                    }
                }
                if(!ok) continue;
                vector<int> foge = tmp;
                foge.push_back(i);
                sort(foge.begin(),foge.end());
                ge.insert(foge);
                int cnt = 0;
                rep(j,foge.size()){
                    int mi = INF;
                    rep(k,foge.size()){
                        if(j == k) continue;
                        mi = min(mi,ed[foge[j]][foge[k]]);
                    }
                    cnt += mi;
                }
                ans = max(ans,cnt);
            }
        }
        ho = ge;
        if(ge.size() == 0) break;
    }
    cout << ans << endl;
}