import java.util.*; import java.io.*; public class Main { static HashMap[] graph; static int[][] dp; static int n; public static void main(String[] args) throws Exception { long start = System.currentTimeMillis(); BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); String[] first = br.readLine().split(" ", 2); n = Integer.parseInt(first[0]); int m = Integer.parseInt(first[1]); graph = new HashMap[n]; for (int i = 0; i < n; i++) { graph[i] = new HashMap<>(); } dp = new int[n][(int)(Math.pow(2, n))]; 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[a].containsKey(b) || graph[a].get(b) < c) { graph[a].put(b, c); } if (!graph[b].containsKey(a) || graph[b].get(a) < c) { graph[b].put(a, c); } } int all = (int)(Math.pow(2, n)) - 1; int max = 0; for (int i = 0; i < n; i++) { max = Math.max(max, dfw(i, (int)(Math.pow(2, i)) ^ all)); } System.out.println(max); } static int dfw(int idx, int key) { if (key == 0) { return 0; } if (dp[idx][key] != 0) { return dp[idx][key]; } int max = 0; for (int i = 0; i < n; i++) { int value = (int)(Math.pow(2, i)); if ((value & key) == 0) { continue; } if (!graph[idx].containsKey(i)) { continue; } max = Math.max(max, dfw(i, key ^ value) + graph[idx].get(i)); } dp[idx][key] = max; return max; } }