#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000000;
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);++i)
#define rep(i,n) REP(i, 0, n)

int w[101][101];
int N, M, ans;
bitset<101> use;
void dfs(int depth) {
    if(depth == N) {
        if(use.count() < 2) return;
        int sum = 0;
        rep(i, N) if(use[i]) {
            int mi = INF;
            rep(j, N) if(i != j && use[j])
              mi = min(mi, w[i][j]);
            sum += mi;
        }
        ans = max(ans, sum);
        return;
    }
    bool ok = true;
    rep(i, depth)
      if(use[i] && !w[i][depth]) ok = false;
    dfs(depth + 1);
    if(ok) {
        use[depth] = 1;
        dfs(depth + 1);
        use[depth] = 0;
    }
    return;
}
int main() {
    scanf("%d%d", &N, &M);
    int u_, v_, w_;
    memset(w, 0, sizeof(w));
    rep(i, M) {
        scanf("%d%d%d", &u_, &v_, &w_);
        --u_; --v_;
        w[u_][v_] = w[v_][u_] = w_;
    }
    ans = 0;
    dfs(0);
    printf("%d\n", ans);
    return 0;
}