import java.io.*; import java.util.Scanner; public class Main_yukicoder845 { private static Scanner sc; private static Printer pr; private static void solve() { // final long INF = Long.MAX_VALUE; int n = sc.nextInt(); int m = sc.nextInt(); int[][] edges = new int[n][n]; for (int i = 0; i < m; i++) { int a = sc.nextInt() - 1; int b = sc.nextInt() - 1; int c = sc.nextInt(); if (c > edges[a][b]) { edges[a][b] = c; edges[b][a] = c; } } long[][] dp = new long[n][0x1 << n]; for (int i = 0; i < 0x1 << n; i++) { for (int j = 0; j < n; j++) { if ((i & 0x1 << j) == 0) { continue; } for (int k = 0; k < n; k++) { if (edges[j][k] == 0) { continue; } if ((i & 0x1 << k) != 0) { continue; } dp[k][i | 0x1 << k] = Math.max(dp[k][i | 0x1 << k], dp[j][i] + edges[j][k]); } } } long ans = 0; for (int i = 0; i < n; i++) { ans = Math.max(ans, dp[i][(0x1 << n) - 1]); } pr.println(ans); } // --------------------------------------------------- public static void main(String[] args) { sc = new Scanner(System.in); pr = new Printer(System.out); solve(); pr.close(); sc.close(); } static class Printer extends PrintWriter { Printer(OutputStream out) { super(out); } } }