#include <bits/stdc++.h>
using namespace std;
int main()
{
    int N, M;
    cin >> N >> M;
    vector<int> dim(N);
    vector<vector<int>> edge(N, vector<int>(N, 0));
    for (int i = 0; i < M; i++) {
        int u, v, c;
        cin >> u >> v >> c;
        u--, v--;
        edge[u][v] = edge[v][u] = c;
        dim[u]++, dim[v]++;
    }
    int ans = 0;
    for (int s = 2; s <= 14; s++) {
        vector<int> cand;
        for (int i = 0; i < N; i++) {
            if (dim[i] >= s - 1) { cand.push_back(i); }
        }
        if (cand.size() < s) { break; }
        const int sz = cand.size();
        vector<bool> mask(sz, false);
        fill(mask.end() - s, mask.end(), true);
        auto score = [&](const vector<int>& node) {
            int ans = 0;
            for (const int i : node) {
                int mini = 1 << 30;
                for (const int j : node) {
                    if (i == j) { continue; }
                    if (edge[i][j] == 0) { return 0; }
                    mini = min(mini, edge[i][j]);
                }
                ans += mini;
            }
            return ans;
        };
        do {
            vector<int> node;
            for (int i = 0; i < sz; i++) {
                if (mask[i]) { node.push_back(cand[i]); }
            }
            ans = max(ans, score(node));
        } while (next_permutation(mask.begin(), mask.end()));
    }
    cout << ans << endl;
    return 0;
}

