import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); ArrayList> graph = new ArrayList<>(); for (int i = 0; i < n; i++) { graph.add(new HashMap<>()); } for (int i = 0; i < m; i++) { int a = sc.nextInt() - 1; int b = sc.nextInt() - 1; int c = sc.nextInt(); if (!graph.get(a).containsKey(b) || graph.get(a).get(b) < c) { graph.get(a).put(b, c); graph.get(b).put(a, c); } } int[][] dp = new int[1 << n][n]; int max = 0; for (int i = 1; i < (1 << n) - 1; i++) { for (int j = 0; j < n; j++) { if ((i & (1 << j)) == 0) { continue; } int tmp = 0; for (int k = 0; k < n; k++) { if (j == k) { continue; } if ((i & (1 << k)) == 0) { continue; } if (!graph.get(j).containsKey(k)) { continue; } tmp = Math.max(tmp, dp[i ^ (1 << j) ^ (1 << k)][k] + graph.get(j).get(k)); } dp[i ^ (1 << j)][j] = tmp; max = Math.max(max, tmp); } } System.out.println(max); } }