import java.util.*; public class Main { static HashMap[] graph; static int max = 0; static int[][] dp; public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); 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++) { int a = sc.nextInt() - 1; int b = sc.nextInt() - 1; int c = sc.nextInt(); 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); } } for (int i = 0; i < n; i++) { int[] costs = new int[n]; Arrays.fill(costs, -1); search(i, 0, costs); } System.out.println(max); } static void search(int idx, int total, int[] costs) { if (costs[idx] != -1) { return; } int key = 0; for (int i = 0; i < costs.length; i++) { key *= 2; if (costs[i] != -1) { key++; } } if (total != 0 && dp[idx][key] >= total) { return; } dp[idx][key] = total; max = Math.max(max, total); costs[idx] = total; for (Map.Entry entry : graph[idx].entrySet()) { search(entry.getKey(), total + entry.getValue(), costs); } costs[idx] = -1; } }