N,M=map(int,input().split()) graph=[[] for x in range(N)] for m in range(M): a,b,c=map(int,input().split()) a-=1;b-=1 graph[a].append((b,c)) graph[b].append((a,c)) inf=1<<30 dp=[[-inf]*N for bit in range(1<