#include <bits/stdc++.h>

using namespace std;

const int NMax = 150;

int A[NMax][NMax];
int used[NMax];
int N, M;

int bkt (int x, int y)
{
    if (x >= N)
	{
        if (y < 2)
			return 0;
		int ans = 0;
		for (int i = 0; i < y; ++i)
		{
            int Min = INT_MAX;

            for (int j = 0; j < y; ++j)
				if (i != j)
					Min = min(Min, A[used[i]][used[j]]);

			ans = ans + Min;
		}

		return ans;
	}

	int ans = bkt(x + 1, y);
	int Ok = 0;

	for (int i = 0; i < y; ++i)
		if (!A[used[i]][x])
			Ok = 1;

	if (!Ok)
	{
        used[y] = x;
        ans = max(ans, bkt(x+1, y+1));
	}

	return ans;
}

int main()
{
	cin >> N >> M;

	for (int i = 0; i < M; ++i)
	{
        int u, v, f;

        cin >> u >> v >> f;
		A[u-1][v-1] = A[v-1][u-1] = f;

	}

	int ans = bkt(0,0);
	cout <<ans <<'\n';
    return 0;
}

