#include <bits/stdc++.h>

using namespace std;

int N, M, G[100][100];

int dfs(int idx, vector< int > used)
{
  if(idx == N) {
    if(used.size() <= 1) return (0);
    int res = 0;
    for(int i : used) {
      int ret = 11451419;
      for(int j : used) if(i != j) ret = min(ret, G[i][j]);
      res += ret;
    }
    return (res);
  } else {
    int res = dfs(idx + 1, used);

    bool isnext = true;
    for(int i : used) if(G[idx][i] == 0) isnext = false;
    if(isnext) {
      used.push_back(idx);
      res = max(res, dfs(idx + 1, used));
    }
    return (res);
  }
}

int main()
{
  cin >> N >> M;
  for(int i = 0; i < M; i++) {
    int A, B, C;
    cin >> A >> B >> C;
    --A, --B;
    G[A][B] = G[B][A] = C;
  }

  cout << dfs(0, vector< int >()) << endl;
}