N,M = map(int,input().split()) UV = [list(map(int,input().split())) for _ in range(M)] P = [[0] * N for _ in range(N)] for u,v,c in UV: P[u][v] = max(P[u][v], c) dp = [-1] * (1 << N) for i in range(N): dp[1<= 0: dp[k|(1<