n,m=map(int,input().split()) score=[[0]*n for _ in range(n)] for _ in range(m): a,b,s=map(int,input().split()) score[a][b]=s dp=[[0]*n for _ in range(1<>v)&1: continue # 配る側 for u in range(n): if (s>>u)&1 : dp[s|(1<