import java.util.*; import java.io.*; public class Main { public static void main (String[] args) throws Exception{ BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] first = br.readLine().split(" ", 2); int n = Integer.parseInt(first[0]); int m = Integer.parseInt(first[1]); ArrayList> graph = new ArrayList<>(); for (int i = 0; i < n; i++) { graph.add(new HashMap<>()); } for (int i = 0; i < m; i++) { String[] line = br.readLine().split(" ", 3); int a = Integer.parseInt(line[0]) - 1; int b = Integer.parseInt(line[1]) - 1; int c = Integer.parseInt(line[2]); if (!graph.get(a).containsKey(b) || graph.get(a).get(b) < c) { graph.get(a).put(b, c); } if (!graph.get(b).containsKey(a) || graph.get(b).get(a) < c) { graph.get(b).put(a, c); } } int[][] dp = new int[n][1 << n]; int max = 0; for (int i = 1; i < (1 << n); i++) { for (int j = 0; j < n; j++) { if ((i & (1 << j)) == 0) { continue; } for (int k = 0; k < n; k++) { if (k == j || (i & (1 << k)) == 0) { continue; } if (graph.get(j).containsKey(k)) { dp[j][i] = Math.max(dp[j][i], dp[k][i ^ (1 << j)] + graph.get(j).get(k)); } } max = Math.max(max, dp[j][i]); } } System.out.println(max); } }