#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const ll MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;
template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}
template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}
struct Edge {
  int from, to, friendliness;
};
map<vector<bool>, int> mp;
ll dfs(int now, vector<bool> &sel, const vector<vector<Edge>> &g, const vvll &d, int n) {
  if(mp[sel] != 0) return mp[sel];
  ll res = 0;
  for(int i=0;i<n;++i) {
    if(!sel[i]) continue;
    ll val = LINF;
    for(int j=0;j<n;++j) {
      if(i == j || !sel[j]) continue;
      val = min(val, d[i][j]);
    }
    if(val == LINF) val = 0;
    res += val;
  }
  for(int i=0;i<(int)(g[now].size());++i) {
    int nxt = g[now][i].to;
    if(sel[nxt]) continue;
    bool ok = true;
    for(int j=0;j<n;++j) {
      if(j == nxt) continue;
      if(sel[j] && d[nxt][j] == 0) {
        ok = false;
        break;
      }
    }
    if(ok) {
      sel[nxt] = true;
      res = max(res, dfs(nxt, sel, g, d, n));
      sel[nxt] = false;
    }
  }
  return mp[sel] = res;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  int n, m; cin >> n >> m;
  vector<vector<Edge>> g(n);
  vvll d(n, vll(n, 0));
  for(int i=0;i<m;++i) {
    int u, v, f; cin >> u >> v >> f;
    u--; v--;
    g[u].push_back({u, v, f});
    g[v].push_back({v, u, f});
    d[u][v] = f;
    d[v][u] = f;
  }
  vector<bool> sel(n, false);
  ll ans = 0;
  for(int i=0;i<n;++i) {
    sel[i] = true;
    ans = max(ans, dfs(i, sel, g, d, n));
    sel[i] = false;
  }
  cout << ans << endl;
}

